db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Burlison <Alan.Burli...@sun.com>
Subject Derby causes PermGen leaks in Tomcat
Date Mon, 24 Sep 2007 12:40:28 GMT
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() 
    java.lang.Thread.State: WAITING (on object monitor)
         at java.lang.Object.wait(Native Method)
         - waiting on <0xcaff88f0> (a 
         at java.lang.Object.wait(Object.java:485)
         at org.apache.derby.impl.services.monitor.AntiGC.run(Unknown 
         - locked <0xcaff88f0> (a 
         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

View raw message