problems in timeout handling
mp at oxado.com
Tue May 15 22:23:43 UTC 2007
i think there is a bug in the way timeout is handled in function
If a timeout occur _dead_sock is called with some parameters among
them $sock: a HANDLE on a memcache server socket.
_dead_sock should use $sock or the string representation and not a
reference to $sock as a key for %sock_map.
The current version of the code is unable to remove the socket and
the handle from the cache and if a timeout happens the socket (that is
closed) and the handle associated to the socket will still be used.
You can check this behaviour by using a sligthly modified version of
api/perl/dev/bench.pl designed to not die if a value returned by
get_multi is not the one expected (comment the die around line 43) and
memcache server instance launched in foreground and adding a message
in the $dead sub in _load_multi to indicate that a timeout has
accoured (ie print "Timeout ... $sockn";)
Start api/perl/dev/bench.pl with a big value (10000 for instance)
and while it is getting the keys (ie. after 100 /10000 is displayed)
suspend the instance (^Z) the message Timeout ... GLOB (0x....) will
be printed and with the original code even if the server comes back
(with fg or bg) the timeout message will still be displayed. When
using "$sock" as a key from %sock_map, the message disappear when the
server comes back.
Am i wrong ? is there some case when searching %sock_map by a
reference on $sock is needed ?
-- OXADO www.oxado.com
More information about the memcached