SrvKetamaClient doesn't shutdown the old client after DNS update
eranharel opened this issue · 1 comments
There's a bug in com.spotify.folsom.ketama.SrvKetamaClient#setPendingClient() which prevents the old client from being shutdown correctly.
The code keeps track of the oldPending
, but it always gets a value that got nullified at the new client connect future callback (line 207).
So when a new list of target host:port pairs is detected the client connects to the new targets correctly, but doesn't disconnect the old clients. Also, when a target memecached is really missing for good, the client will keep trying to reconnect.
I think there's also an issue of a possible premature shutdown there if the code would have worked correctly. The lines 218-221 should be moved into the connect future callback IMO.
I can work on a patch for this tomorrow.
Correction. I missed the scheduled shutdown which only happens after 60 sec, so I didn't see it in my tests :P
The code in lines 218-221 should probably be removed though, but I'm closing this ticket.