Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 99DFE200C50 for ; Fri, 24 Mar 2017 19:14:51 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 986ED160B75; Fri, 24 Mar 2017 18:14:51 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id DC365160B93 for ; Fri, 24 Mar 2017 19:14:50 +0100 (CET) Received: (qmail 37007 invoked by uid 500); 24 Mar 2017 18:14:49 -0000 Mailing-List: contact dev-help@zookeeper.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@zookeeper.apache.org Delivered-To: mailing list dev@zookeeper.apache.org Received: (qmail 36972 invoked by uid 99); 24 Mar 2017 18:14:48 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Mar 2017 18:14:48 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id E94D41865E7 for ; Fri, 24 Mar 2017 18:14:47 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.201 X-Spam-Level: X-Spam-Status: No, score=-99.201 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id m3eX5dJ_qFWj for ; Fri, 24 Mar 2017 18:14:46 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 016DB5FB86 for ; Fri, 24 Mar 2017 18:14:46 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 39F78E0059 for ; Fri, 24 Mar 2017 18:14:42 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id E1BD724065 for ; Fri, 24 Mar 2017 18:14:41 +0000 (UTC) Date: Fri, 24 Mar 2017 18:14:41 +0000 (UTC) From: "Hadoop QA (JIRA)" To: dev@zookeeper.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (ZOOKEEPER-2737) NettyServerCnxFactory leaks connection if exception happens while writing to a channel. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Fri, 24 Mar 2017 18:14:51 -0000 [ https://issues.apache.org/jira/browse/ZOOKEEPER-2737?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15940852#comment-15940852 ] Hadoop QA commented on ZOOKEEPER-2737: -------------------------------------- +1 overall. GitHub Pull Request Build +1 @author. The patch does not contain any @author tags. +0 tests included. The patch appears to be a documentation patch that doesn't require tests. +1 javadoc. The javadoc tool did not generate any warning messages. +1 javac. The applied patch does not increase the total number of javac compiler warnings. +1 findbugs. The patch does not introduce any new Findbugs (version 3.0.1) warnings. +1 release audit. The applied patch does not increase the total number of release audit warnings. +1 core tests. The patch passed core unit tests. +1 contrib tests. The patch passed contrib unit tests. Test results: https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build/478//testReport/ Findbugs warnings: https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build/478//artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html Console output: https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build/478//console This message is automatically generated. > NettyServerCnxFactory leaks connection if exception happens while writing to a channel. > --------------------------------------------------------------------------------------- > > Key: ZOOKEEPER-2737 > URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2737 > Project: ZooKeeper > Issue Type: Bug > Components: server > Affects Versions: 3.5.2 > Reporter: Michael Han > Assignee: Michael Han > Priority: Critical > Labels: connection, netty, server > > Found this while debugging occasionally failed unit tests. Currently we do this if exception occurs during writing to a channel with Netty: > {code} > @Override > public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) > throws Exception > { > LOG.warn("Exception caught " + e, e.getCause()); > NettyServerCnxn cnxn = (NettyServerCnxn) ctx.getAttachment(); > if (cnxn != null) { > if (LOG.isDebugEnabled()) { > LOG.debug("Closing " + cnxn); > cnxn.close(); > } > } > } > {code} > So the connection is only closed when debug mode is enabled. This is problematic as lots of clean up code is abstracted inside the close and without proper close the connection we are leaking resources. > [Commit log|https://github.com/apache/zookeeper/blob/master/src/java/main/org/apache/zookeeper/server/NettyServerCnxnFactory.java#L147] indicates the issue exists since day 1 with ZOOKEEPER-733. Note the original patch uploaded to ZOOKEEPER-733 has this close call in right place, and the call gets moved around during iteration of the patches w/o gets noticed. -- This message was sent by Atlassian JIRA (v6.3.15#6346)