Github user lvfangmin commented on the issue:
https://github.com/apache/zookeeper/pull/611
@hanm based on @wangchaod's description in the JIRA, #612 should fix the
exact issue.
@anmolnar as I commented in the JIRA, not removing the empty map is
optimized from performance perspective, like not need to remove/add the entry
for the same connection again after the watch triggered and client reset the
watch, which will reduce the GC overhead, also it reduces the lock contention.
Since the maximum number of map entries in watch2Paths won't larger than
the total connections number on that server, leave an empty map entry there
won't cost too much memory overhead.
Without the fix in #612, the map will grow infinitely as the ZK runs and
client reconnect going on, which will cause the OOM problem.
This is actually a critical bug for NettyServerCnxn implementation,
wondering why we didn't saw other people report this.
Internally, we're using NIO, but we're planning to move onto Netty to get
the TLS support. So recently, I'm working on improving the Netty
implementation, adding features missing compared to NIO, for example, the
maximum cnxns per IP limit support, the ideal cnxn expirer, the session map to
improve the performance, etc, I'll send out the diffs, please help review.
---