Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 27004 invoked from network); 7 Mar 2006 15:59:59 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 7 Mar 2006 15:59:59 -0000 Received: (qmail 39877 invoked by uid 500); 7 Mar 2006 15:59:22 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 39837 invoked by uid 500); 7 Mar 2006 15:59:21 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 39828 invoked by uid 99); 7 Mar 2006 15:59:21 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Mar 2006 07:59:21 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=UNPARSEABLE_RELAY X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [192.18.98.43] (HELO brmea-mail-2.sun.com) (192.18.98.43) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Mar 2006 07:59:20 -0800 Received: from phys-gadget-1 ([129.156.85.171]) by brmea-mail-2.sun.com (8.12.10/8.12.9) with ESMTP id k27Fwx8u015155 for ; Tue, 7 Mar 2006 08:59:00 -0700 (MST) Received: from conversion-daemon.gadget-mail1.uk.sun.com by gadget-mail1.uk.sun.com (iPlanet Messaging Server 5.2 HotFix 1.24 (built Dec 19 2003)) id <0IVR00H01LLQPE@gadget-mail1.uk.sun.com> (original mail from John.Embretsen@Sun.COM) for derby-dev@db.apache.org; Tue, 07 Mar 2006 15:58:59 +0000 (GMT) Received: from [129.159.112.236] (khepri24.Norway.Sun.COM [129.159.112.236]) by gadget-mail1.uk.sun.com (iPlanet Messaging Server 5.2 HotFix 1.24 (built Dec 19 2003)) with ESMTPA id <0IVR00M3BLQAK0@gadget-mail1.uk.sun.com> for derby-dev@db.apache.org; Tue, 07 Mar 2006 15:58:59 +0000 (GMT) Date: Tue, 07 Mar 2006 16:54:43 +0100 From: John Embretsen Subject: Re: [jira] Updated: (DERBY-210) Network Server will leak prepared statements if not explicitly closed by the user until the connection is closed In-reply-to: <440D7D90.6010003@Sun.COM> To: derby-dev@db.apache.org Reply-to: derby-dev@db.apache.org Message-id: <440DACC3.4040209@Sun.COM> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7BIT User-Agent: Thunderbird 1.5 (X11/20060113) References: <1527603664.1113181887106.JavaMail.jira@ajax.apache.org> <851627339.1141405603295.JavaMail.jira@ajax.apache.org> <58ed70f50603061503l139220d3n91797d50f52ae7c9@mail.gmail.com> <440D7D90.6010003@Sun.COM> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N John Embretsen wrote: > Deepa Remesh wrote: > >> Thanks John for uploading your repro. I have not been able to look at >> it closely as jira seems to be having problems again. I was wondering >> if you have the results from your DOTS test. Please post if you have >> any updates. > > Actually, the DOTS test failed, i.e. the network server hit an > OutOfMemoryError (PermGenSpace) after about 56 hours (not much longer > than without the patch), but I suspect that something is not right... > > I get strange results from running my repro with the same jars, and > *sometimes* with freshly built jars even with your patch included. This > is not what I was seeing before the weekend. I am doing some detective > work to figure out what could be wrong with my environment (scripts, > classpaths, JVM settings, build process, patch, etc.). When I figure it > out, I will re-run the tests and post results. I think I figured out what was causing the unpredictable results when running my repro: I was (most of the time, both for DOTS and my repro) running with the following flags on the server JVM: -Xms128m -Xmx128m -XX:PermSize=64m -XX:MaxPermSize=64m These flags are setting both initial and max size of both heap and PermGen space, with initial size equal to max size. This was to ease debugging (I think it is easier to interpret memory usage graphs when I know the capacities of the different parts of the heap). Besides, people recommend setting initial and max heap size equal to each other for performance reasons, so I did the same for the permanent generation. Anyway, I found out that *without* the flag "-XX:PermSize=64m" the test/repro "passed", while *with* the flag set, the server usually crashed at approximately 11000 statements. Here is my theory, based on observation of jstat output: With my repro, derby generates classes faster than the VM is able to garbage collect in one go. According to PermGen usage logs (jstat), roughly 500k worth of bytecode is injected into the permanent generation per second (I guess mostly due to class generation since most statements sent from the client are unique). So, when the initial PermGen size is smaller, i.e. not close to, the max size, the VM can increase PermGen capacity while garbage collecting old classes (or something like that). Perhaps there is some small delay before classes can be unloaded/GCed, I don't know. I have successfully and predicably run my repro again, now without the "-XX:PermSize" flag set. Without patch5 for DERBY-210, the server hits an OutOfMemoryError after roughly 11000 statements. With patch5, the server is able to gc all parts of the heap, including the PermGen space (I have tested 100000 statements so far, after I discovered this issue). I have started a new DOTS test run, this time without setting the initial PermGen size. I am crossing my fingers and hoping this will improve the results of the DOTS test. There could of course be other issues with my environment, so I still recommend that others try some of these tests/repros. Use whatever JVM settings you feel like, but I recommend not setting initial PermSize equal (or close) to max PermSize. -- John