Activity log for bug #1135781

Date Who What changed Old value New value Message
2013-02-28 14:01:31 Martin C. Martin bug added bug
2013-02-28 14:05:05 Martin C. Martin 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_SERVER_STATE_NEW, not MEMCACHED_SERVER_STATE_IN_TIMEOUT. memcached_mark_server_for_timeout() only skips updating next_retry in the latter state, not the former. I'm not sure what the right solution is here. Maybe make memcached_quit_server() idempotent by checking for MEMCACHED_SERVER_STATE_NEW or fd == INVALID_SOCKET at the start and returing right away? I'm reluctant to do the same in memcached_mark_server_for_timeout(), in case that skips setting it when we really do need to set it. 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_SERVER_STATE_NEW, not MEMCACHED_SERVER_STATE_IN_TIMEOUT. memcached_mark_server_for_timeout() only skips updating next_retry in the latter state, not the former. I'm not sure what the right solution is here. Maybe make memcached_quit_server() idempotent by checking for MEMCACHED_SERVER_STATE_NEW at the start and returing right away? I'm reluctant to do the same in memcached_mark_server_for_timeout(), in case that skips setting it when we really do need to set it.
2013-02-28 14:44:33 Martin C. Martin summary Never reconnect after connection reset Never reconnect after connection reset (binary protocol)
2013-03-01 13:58:15 Martin C. Martin attachment added reconnect.patch https://bugs.launchpad.net/libmemcached/+bug/1135781/+attachment/3552872/+files/reconnect.patch
2013-04-03 21:07:25 Brian Aker libmemcached: assignee Brian Aker (brianaker)
2013-04-03 21:07:38 Brian Aker libmemcached: milestone 1.0.18