Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 27685 invoked from network); 24 Sep 2007 12:41:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 24 Sep 2007 12:41:04 -0000 Received: (qmail 55453 invoked by uid 500); 24 Sep 2007 12:40:53 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 55420 invoked by uid 500); 24 Sep 2007 12:40:53 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 55409 invoked by uid 99); 24 Sep 2007 12:40:53 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Sep 2007 05:40:53 -0700 X-ASF-Spam-Status: No, hits=-1.0 required=10.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [192.18.43.21] (HELO sca-ea-mail-3.sun.com) (192.18.43.21) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Sep 2007 12:43:03 +0000 Received: from dm-uk-01.uk.sun.com ([129.156.101.115]) by sca-ea-mail-3.sun.com (8.13.6+Sun/8.12.9) with ESMTP id l8OCeSRv020278 for ; Mon, 24 Sep 2007 12:40:29 GMT Received: from barman.uk.sun.com (barman.UK.Sun.COM [129.156.132.12]) by dm-uk-01.uk.sun.com (8.13.7+Sun/8.13.6/ENSMAIL,v2.2) with ESMTP id l8OCeSBH025641 for ; Mon, 24 Sep 2007 13:40:28 +0100 (BST) Received: from vpn-129-150-121-224.uk.sun.com ([129.150.121.224]) by barman.uk.sun.com with esmtp (Exim 4.42) id 1IZnH5-0006im-0j for derby-user@db.apache.org; Mon, 24 Sep 2007 13:42:55 +0100 Message-ID: <46F7B03C.8040204@sun.com> Date: Mon, 24 Sep 2007 13:40:28 +0100 From: Alan Burlison User-Agent: Thunderbird 2.0.0.4 (X11/20070814) MIME-Version: 1.0 To: Derby Discussion Subject: Derby causes PermGen leaks in Tomcat Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org I have a webapp running under Tomcat with Derby embedded inside it, and after a number of redeploys Tomcat falls over with the dreaded PermGen space error. I'm running Derby in server mode as I want to be able to connect to it externally whilst the webapp is running. The webapp has startup/shutdown hooks to start and stop Derby, but the 'stop' part obviously isn't working. I'm doing a DriverManager.getConnection() with shutdown=true, followed by NetworkServerControl.shutdown(). After this I can't connect to the database (as expected), but jmap shows a load of Derby objects are still loaded, and jstack shows several instances of this: "derby.antiGC" daemon prio=1 tid=0x088e7000 nid=0xd in Object.wait() [0xc64ce000..0xc64ceb60] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(Native Method) - waiting on <0xcaff88f0> (a org.apache.derby.impl.services.monitor.AntiGC) at java.lang.Object.wait(Object.java:485) at org.apache.derby.impl.services.monitor.AntiGC.run(Unknown Source) - locked <0xcaff88f0> (a org.apache.derby.impl.services.monitor.AntiGC) at java.lang.Thread.run(Thread.java:619) So it's clear that although the Derby server is stopped, it's still zombified somewhere inside the Tomcat JVM. How do I cleanly and completely remove Derby from a running JVM? -- Alan Burlison --