Return-Path: X-Original-To: apmail-accumulo-dev-archive@www.apache.org Delivered-To: apmail-accumulo-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id ADC2610A6F for ; Fri, 27 Dec 2013 19:23:37 +0000 (UTC) Received: (qmail 89331 invoked by uid 500); 27 Dec 2013 19:23:37 -0000 Delivered-To: apmail-accumulo-dev-archive@accumulo.apache.org Received: (qmail 89254 invoked by uid 500); 27 Dec 2013 19:23:37 -0000 Mailing-List: contact dev-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list dev@accumulo.apache.org Received: (qmail 89246 invoked by uid 99); 27 Dec 2013 19:23:37 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Dec 2013 19:23:37 +0000 X-ASF-Spam-Status: No, hits=2.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_SOFTFAIL X-Spam-Check-By: apache.org Received-SPF: softfail (athena.apache.org: transitioning domain of wilhelm.von.cloud@accumulo.net does not designate 209.85.216.52 as permitted sender) Received: from [209.85.216.52] (HELO mail-qa0-f52.google.com) (209.85.216.52) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Dec 2013 19:23:32 +0000 Received: by mail-qa0-f52.google.com with SMTP id cm18so8841183qab.4 for ; Fri, 27 Dec 2013 11:23:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=TXThMnxlXwAHgqo2GeuAr3NipFpPDo6r8IqzkDyXjiM=; b=MkQ320xzBRJdd/69QOnX+FUitiACfj/bXd1J/MTHADBLCGwWp4zVji86tgAjrRQge5 JEuzCkBVhIIco0gmWwHEBxYWUDhNNlYyRYKizXiqHlm2ALBx82H+PfgnhdKtkAwaoVn1 otA//47gT47j4WbqxwK+LzCQ9UpCVrGuv/aB/nTEfV5IWeeEYckq2Gy83OzHTMgjp/cf omUIFlbFJ4Vou3C2o1j7A6NJI0Ckhvnnrq2mdkL7mMW6IU1j20LsvZ3vz1gzm+5RVZTM xZE7aYtfF/r+29TZGN0cbjjiUSa6oTtNvGdsS3jR9LrBlqBxqa2wjuiljaKlqdZy9ENA vwTQ== X-Gm-Message-State: ALoCoQloUfOnp+pIoocavF9FysUwRAo81jBIj7xGsOYJ1P+e2F/se/GJT3hyB22dGTh6qMonLqUZ MIME-Version: 1.0 X-Received: by 10.49.53.66 with SMTP id z2mr83839876qeo.45.1388172191005; Fri, 27 Dec 2013 11:23:11 -0800 (PST) Received: by 10.229.252.131 with HTTP; Fri, 27 Dec 2013 11:23:10 -0800 (PST) X-Originating-IP: [98.117.207.73] In-Reply-To: References: Date: Fri, 27 Dec 2013 14:23:10 -0500 Message-ID: Subject: Re: Resource leak warnings From: William Slacum To: dev@accumulo.apache.org Content-Type: multipart/alternative; boundary=047d7bd75e90552a4604ee890688 X-Virus-Checked: Checked by ClamAV on apache.org --047d7bd75e90552a4604ee890688 Content-Type: text/plain; charset=ISO-8859-1 We need to actually define the usage pattern and lifetime of a ZooKeeperInstance. Looking at the code, it's really masking a singleton usage pattern. The resources backing a given set of zookeepers+timeout pair all share a ZooCache, and we hand-rolled reference counting for ZooKeeperInstances themselves. That indicates that a ZooKeeperInstance is basically a global variable, and we have to be careful about the resources it allocates, directly or indirectly, because their lifetimes are opaque from the perspective of the client. I'm a fan of the close method, because it puts, in code, how an instance tidies up after itself. We didn't have any cleanup before because the ZooCache for a given zookeeper+timeout lived on until the process died. Since the side effects of our API aren't documented or made clear to the client, it's on us to handle and manage them. Making it optional for a user is a benefit, because maybe they don't care and someone else (gc, another management thread) will call close() on the instance, or maybe they want to force a close at class unloading. The utility seems to be brute forcing shutdown- is it possible to get something finer grained for specific instances? Shutting down every thing will handle the "clean up at unload" time issue, but not necessarily anything involving closing down a subset of ZooSessions. On Thu, Dec 26, 2013 at 2:48 PM, Sean Busbey wrote: > On Dec 26, 2013 12:27 PM, "Mike Drob" wrote: > > > > I'm willing to stipulate that this solves the thread leak from web > > containers - I haven't verified it, but I am ever hopeful. Does this > > solution imply that we should nix the close() methods just added in the > > snapshot branches? > > > > > > If we can verify that it solves the leaks for web containers, I would say > yes. > > We can do proper life cycle for persistent state when we provide an updated > client API. > --047d7bd75e90552a4604ee890688--