You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "IndiraFinish (GitHub)" <gi...@apache.org> on 2020/05/02 04:53:03 UTC

[GitHub] [dubbo] IndiraFinish opened issue #6089: NettyChannel的close方法是否有内存泄漏的风险

```
public void close() {
        try {
            super.close();
        } catch (Exception e) {
            logger.warn(e.getMessage(), e);
        }
        try {
            removeChannelIfDisconnected(channel);(1)
        } catch (Exception e) {
            logger.warn(e.getMessage(), e);
        }
        try {
            attributes.clear();
        } catch (Exception e) {
            logger.warn(e.getMessage(), e);
        }
        try {
            if (logger.isInfoEnabled()) {
                logger.info("Close netty channel " + channel);
            }
            channel.close();(2)
        } catch (Exception e) {
            logger.warn(e.getMessage(), e);
        }
    }
```

先移除channelMap的引用,会校验netty的通道是否激活,如果激活就没有办法移除。
这种情况下先调用(1)再调用(2)是否会有内存泄漏的风险

[ Full content available at: https://github.com/apache/dubbo/issues/6089 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org