zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Fangmin Lv (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (ZOOKEEPER-3131) org.apache.zookeeper.server.WatchManager resource leak
Date Thu, 30 Aug 2018 15:50:00 GMT

    [ https://issues.apache.org/jira/browse/ZOOKEEPER-3131?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16597590#comment-16597590

Fangmin Lv commented on ZOOKEEPER-3131:

[~hw_wangchao] it was by design to leave it as is to improve the performance, since the
watcher number is usually related with the connections on that server, and we can rely on
the connection close to clean it up. 

The problem here is that, NettyServerCnxn didn't remove itself from ZK server as what we did
in NIOServerCnxn, that's why it starts to leak slowly. I have a patch to make the behavior
consistent with NIOServerCnxn, I can send it out today.

There are also other features missing comparing to NIO, for example, it's missing the maximum
cnxns per IP limit support, doesn't have cnxn expirer, the NettyServerCnxnFactory.closeSession
is not that efficient, etc. I'm recently working on get netty prod ready, I'll send out other
patches as well.

> org.apache.zookeeper.server.WatchManager resource leak
> ------------------------------------------------------
>                 Key: ZOOKEEPER-3131
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-3131
>             Project: ZooKeeper
>          Issue Type: Bug
>          Components: server
>    Affects Versions: 3.5.3, 3.5.4
>         Environment: -Xmx512m 
>            Reporter: ChaoWang
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
> In some cases, the variable _watch2Paths_ in _Class WatchManager_ does not remove the
entry, even if the associated value "HashSet" is empty already. 
> The type of key in Map _watch2Paths_ is Watcher, instance of _NettyServerCnxn._ If
it is not removed when the associated set of paths is empty, it will cause the memory increases
little by little, and OutOfMemoryError triggered finally. 
> {color:#FF0000}*Possible Solution:*{color}
> In the following function, the logic should be added to remove the entry.
> org.apache.zookeeper.server.WatchManager#removeWatcher(java.lang.String, org.apache.zookeeper.Watcher)
> if (paths.isEmpty())
> { watch2Paths.remove(watcher); }
> For the following function as well:
> org.apache.zookeeper.server.WatchManager#triggerWatch(java.lang.String, org.apache.zookeeper.Watcher.Event.EventType,
> Please confirm this issue?

This message was sent by Atlassian JIRA

View raw message