killme2008 / xmemcached

High performance, easy to use multithreaded memcached client in java.
http://fnil.net/xmemcached
Apache License 2.0
757 stars 280 forks source link

HealSession causes Too many open files #83

Closed matejuh closed 6 years ago

matejuh commented 6 years ago

Using HealSession with SessionMonitor. When instance hostname is unresolvable connect throws UnresolvedAddressException, but socket is already opened and not closed. That quickly resolves in Too many open files exception because exception is thrown instead of failing the future, so exponential retry is not used but immediate one. Number of retries is not updated because exception is thrown, so handled there.

Proposed change (without tests and proper formatting): https://github.com/killme2008/xmemcached/compare/master...matejuh:heal_fix?diff=split&expand=1&name=heal_fix

killme2008 commented 6 years ago

Thanks for your report, yep, it should close the channel event it's not an IOException here, can you make PR for this? thanks

matejuh commented 6 years ago

https://github.com/killme2008/xmemcached/pull/84

matejuh commented 6 years ago

Do you plan to release it?

Is there any specific reason why HealThread is not per backend instance (key in sessionMap), but per each connection instance (value in sessionMap)?

killme2008 commented 6 years ago
Do you plan to release it?

I will release it tonight.

Is there any specific reason why HealThread is not per backend instance (key in sessionMap), but per each connection instance (value in sessionMap)?

Because client may use connection pool(session pool).

killme2008 commented 6 years ago

2.4.4 released.

https://github.com/killme2008/xmemcached/releases/tag/xmemcached-2.4.4

But it may take sometime to be synced into central repository.