Never reconnect after connection reset (binary protocol)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
libmemcached |
New
|
Undecided
|
Brian Aker |
Bug Description
When I restart my memcached server, libmemcached never reconnects as long as I'm continuously trying to send data to it. If the client stops activity for a few seconds then starts sending again, the reconnection happens just fine.
It turns out to be a problem with how next_rety is set. Even when we don't try to connect because it's too soon, we still update next_retry.
That's because the socket is invalid, so the server state is MEMCACHED_
I'm not sure what the right solution is here. Maybe make memcached_
description: | updated |
Changed in libmemcached: | |
assignee: | nobody → Brian Aker (brianaker) |
milestone: | none → 1.0.18 |
Simply checking for MEMCACHED_ SERVER_ STATE_NEW in memcached_ quit_server( ) won't work, because it's already in MEMCACHED_ SERVER_ STATE_IN_ TIMEOUT.
Perhaps the problem is in memcached_ send_binary. memcached_ send_ascii has different logic here. When it writes the header, if we don't want a reply or flush we return right away. Otherwise, we only call memcached_io_reset if the return code is MEMCACHED_ WRITE_FAILURE. Should the binary protocl use the same behavior? Perhaps there's a refactoring where we can write the logic once and use it for both the binary and ascii protocols, but that can be left to another time.