You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Torgeir Veimo <to...@pobox.com> on 2006/10/18 14:56:18 UTC

permgen error with jackrabbit 1.1

I'm getting out of permgen space with jackrabbit running under tomcat  
when the webapp has been reloaded enough times.

I've been trying to find the problem using jconsole, and it appears  
if I do a session.login(); and session.logout(), then a good number  
of classes will not be unloaded after the webapp has been reloaded.  
I'm using TransientRepository and the following repository.xml file:

<Repository>
     <FileSystem  
class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
         <param name="path" value="${rep.home}/repository"/>
     </FileSystem>
     <Security appName="Jackrabbit">
         <AccessManager  
class="org.apache.jackrabbit.core.security.SimpleAccessManager"/>
         <LoginModule  
class="org.apache.jackrabbit.core.security.SimpleLoginModule">
            <!-- anonymous user name ('anonymous' is the default  
value) -->
            <param name="anonymousId" value="anonymous"/>
         </LoginModule>
     </Security>
     <Workspaces rootPath="${rep.home}/workspaces"  
defaultWorkspace="default" />
     <Workspace name="${wsp.name}">
         <FileSystem  
class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
             <param name="path" value="${wsp.home}"/>
         </FileSystem>
         <PersistenceManager  
class="org.apache.jackrabbit.core.state.xml.XMLPersistenceManager" />
         <SearchIndex  
class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
             <param name="path" value="${wsp.home}/index"/>
             <param name="autoRepair" value="true"/>
             <param name="analyzer"  
value="org.apache.lucene.analysis.standard.StandardAnalyzer"/>
             <param name="textFilterClasses"
                  
value="org.apache.jackrabbit.core.query.HTMLTextFilter,org.apache.jackra 
bbit.core.query.XMLTextFilter"/>
         </SearchIndex>
     </Workspace>
     <Versioning rootPath="${rep.home}/versions">
         <FileSystem  
class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
             <param name="path" value="${rep.home}/versions"/>
         </FileSystem>
         <PersistenceManager  
class="org.apache.jackrabbit.core.state.xml.XMLPersistenceManager" />
     </Versioning>
</Repository>

The code that is running and using Jackrabbit is limited to this:

String rootDirectory = (String) ConfigManager.getEnvironmentEntry 
("jackrabbit/directory");
String configFile = (String) ConfigManager.getEnvironmentEntry 
("jackrabbit/configfile");

URL url = event.getServletContext().getResource(configFile);
InputStream repositoryXml = event.getServletContext 
().getResourceAsStream(configFile);
RepositoryConfig config = RepositoryConfig.create(repositoryXml,  
rootDirectory);
repository = new TransientRepository(config);

Session session = repository.login();
session.logout();


-- 
Torgeir Veimo
torgeir@pobox.com




Re: permgen error with jackrabbit 1.1

Posted by Torgeir Veimo <to...@pobox.com>.
On 18 Oct 2006, at 18:02, Michael Neale wrote:

> PermSpace is normally due to lots of classes being generated - I am  
> pretty
> sure jackrabbit does none of that, therefore its the tomcat/loading
> reloading (but that doesn't explain why it only happens for tomcat).

It happens after repeated redeployments of the application. There's a  
description about how to see it here: http://weblogs.java.net/blog/ 
richunger/archive/2006/09/debugging_permg.html

I tried to pin down which class triggers the behavior, but so far  
I've only determined that it happens if I log into the repository. If  
I create a repository, but don't log in, it doesn't happen.

-- 
Torgeir Veimo
torgeir@pobox.com




Re: permgen error with jackrabbit 1.1

Posted by Michael Neale <mi...@gmail.com>.
PermSpace is normally due to lots of classes being generated - I am pretty
sure jackrabbit does none of that, therefore its the tomcat/loading
reloading (but that doesn't explain why it only happens for tomcat).

I am pretty sure Java 5 is not "beta" though ?

On 10/18/06, Alexandru Popescu <th...@gmail.com> wrote:
>
> On 10/18/06, Torgeir Veimo <to...@pobox.com> wrote:
> >
> > On 18 Oct 2006, at 16:14, Dan Connelly wrote:
> >
> > > Torgeir:
> > >
> > > Let me guess that you are using Sun's Java 5 JVM.   Perhaps even
> > > the 64-bit JVM.   These are still beta releases.
> >
> > No this is on a mac, with the latest 1.5 jdk for mac.
> >
> > > The same problem exists with Eclipse running under Sun Java 5 if a
> > > fairly large number of plugins has been used (loaded) in one session.
> >
> > I've seen bug reports about this when running the server vm, but the
> > problem here is that it's only jackrabbit which is triggering this
> > problem.
> >
>
> There may be some classes hanging around after you undeploy the
> application. I think with a profiler you will be able to figure out
> which are these, and with a good report I am almost sure somebody will
> try to look how things can be improved.
>
> ./alex
> --
> .w( the_mindstorm )p.
>
> > --
> > Torgeir Veimo
> > torgeir@pobox.com
> >
> >
> >
> >
>

Re: permgen error with jackrabbit 1.1

Posted by Alexandru Popescu <th...@gmail.com>.
On 10/18/06, Torgeir Veimo <to...@pobox.com> wrote:
>
> On 18 Oct 2006, at 16:14, Dan Connelly wrote:
>
> > Torgeir:
> >
> > Let me guess that you are using Sun's Java 5 JVM.   Perhaps even
> > the 64-bit JVM.   These are still beta releases.
>
> No this is on a mac, with the latest 1.5 jdk for mac.
>
> > The same problem exists with Eclipse running under Sun Java 5 if a
> > fairly large number of plugins has been used (loaded) in one session.
>
> I've seen bug reports about this when running the server vm, but the
> problem here is that it's only jackrabbit which is triggering this
> problem.
>

There may be some classes hanging around after you undeploy the
application. I think with a profiler you will be able to figure out
which are these, and with a good report I am almost sure somebody will
try to look how things can be improved.

./alex
--
.w( the_mindstorm )p.

> --
> Torgeir Veimo
> torgeir@pobox.com
>
>
>
>

Re: permgen error with jackrabbit 1.1

Posted by Torgeir Veimo <to...@pobox.com>.
On 18 Oct 2006, at 16:14, Dan Connelly wrote:

> Torgeir:
>
> Let me guess that you are using Sun's Java 5 JVM.   Perhaps even  
> the 64-bit JVM.   These are still beta releases.

No this is on a mac, with the latest 1.5 jdk for mac.

> The same problem exists with Eclipse running under Sun Java 5 if a  
> fairly large number of plugins has been used (loaded) in one session.

I've seen bug reports about this when running the server vm, but the  
problem here is that it's only jackrabbit which is triggering this  
problem.

-- 
Torgeir Veimo
torgeir@pobox.com




Re: permgen error with jackrabbit 1.1

Posted by Dan Connelly <ds...@adelphia.net>.
Torgeir:

Let me guess that you are using Sun's Java 5 JVM.   Perhaps even the 
64-bit JVM.   These are still beta releases.

The same problem exists with Eclipse running under Sun Java 5 if a 
fairly large number of plugins has been used (loaded) in one session.

The Eclipse Bugzilla for this crash blames it on bogus GC in the Sun JVM.  

One solution is to drop back to Sun JVM 1.4.2.   Or, find another vendor.

Of course, you can configure the Sun Java 5 JVM for extra large 
permspace allocation.  
For instance:  -XX:PermSize=80M  -XX:MaxPermSize=128M

This will postpone the inevitable collapse.

       -- Dan


Torgeir Veimo wrote:

> I'm getting out of permgen space with jackrabbit running under tomcat  
> when the webapp has been reloaded enough times.
>
> I've been trying to find the problem using jconsole, and it appears  
> if I do a session.login(); and session.logout(), then a good number  
> of classes will not be unloaded after the webapp has been reloaded.  
> I'm using TransientRepository and the following repository.xml file:
>
> <Repository>
>     <FileSystem  
> class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
>         <param name="path" value="${rep.home}/repository"/>
>     </FileSystem>
>     <Security appName="Jackrabbit">
>         <AccessManager  
> class="org.apache.jackrabbit.core.security.SimpleAccessManager"/>
>         <LoginModule  
> class="org.apache.jackrabbit.core.security.SimpleLoginModule">
>            <!-- anonymous user name ('anonymous' is the default  
> value) -->
>            <param name="anonymousId" value="anonymous"/>
>         </LoginModule>
>     </Security>
>     <Workspaces rootPath="${rep.home}/workspaces"  
> defaultWorkspace="default" />
>     <Workspace name="${wsp.name}">
>         <FileSystem  
> class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
>             <param name="path" value="${wsp.home}"/>
>         </FileSystem>
>         <PersistenceManager  
> class="org.apache.jackrabbit.core.state.xml.XMLPersistenceManager" />
>         <SearchIndex  
> class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
>             <param name="path" value="${wsp.home}/index"/>
>             <param name="autoRepair" value="true"/>
>             <param name="analyzer"  
> value="org.apache.lucene.analysis.standard.StandardAnalyzer"/>
>             <param name="textFilterClasses"
>                  
> value="org.apache.jackrabbit.core.query.HTMLTextFilter,org.apache.jackra 
> bbit.core.query.XMLTextFilter"/>
>         </SearchIndex>
>     </Workspace>
>     <Versioning rootPath="${rep.home}/versions">
>         <FileSystem  
> class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
>             <param name="path" value="${rep.home}/versions"/>
>         </FileSystem>
>         <PersistenceManager  
> class="org.apache.jackrabbit.core.state.xml.XMLPersistenceManager" />
>     </Versioning>
> </Repository>
>
> The code that is running and using Jackrabbit is limited to this:
>
> String rootDirectory = (String) ConfigManager.getEnvironmentEntry 
> ("jackrabbit/directory");
> String configFile = (String) ConfigManager.getEnvironmentEntry 
> ("jackrabbit/configfile");
>
> URL url = event.getServletContext().getResource(configFile);
> InputStream repositoryXml = event.getServletContext 
> ().getResourceAsStream(configFile);
> RepositoryConfig config = RepositoryConfig.create(repositoryXml,  
> rootDirectory);
> repository = new TransientRepository(config);
>
> Session session = repository.login();
> session.logout();
>
>


Re: permgen error with jackrabbit 1.1

Posted by Torgeir Veimo <to...@pobox.com>.
On 26 Oct 2006, at 09:15, Marcel Reutegger wrote:

> problem is with the design of the java.util.Timer class. There's a  
> circular dependency:
>
> - the background thread won't stop until the its timer instance is  
> garbage collected
> - the timer instance won't get collected until the background  
> thread is stopped
>
> :-/
>
>
> I guess you have to wait for 1.1.1 or patch your jackrabbit with  
> the changes for JCR-600.

I patched my 1.1 setup, and I'm still seeing permgen exhausted. I've  
attached some screenshots to JCR-600.

-- 
Torgeir Veimo
torgeir@pobox.com




Re: permgen error with jackrabbit 1.1

Posted by Marcel Reutegger <ma...@gmx.net>.
Torgeir Veimo wrote:
> Is there a way to force that thread to close, by adding any jackrabbit 
> internal dependant code in my context listener close method?

not that I know of. the problem is with the design of the java.util.Timer class. 
There's a circular dependency:

- the background thread won't stop until the its timer instance is garbage collected
- the timer instance won't get collected until the background thread is stopped

:-/


I guess you have to wait for 1.1.1 or patch your jackrabbit with the changes for 
JCR-600.

regards
  marcel

Re: permgen error with jackrabbit 1.1

Posted by Torgeir Veimo <to...@pobox.com>.
On 24 Oct 2006, at 09:23, Marcel Reutegger wrote:

>
> There is a java.util.Timer deamon thread running in the background  
> that prevents tomcat from garbage collecting the classes. I've  
> created a jira issue:
> http://issues.apache.org/jira/browse/JCR-600

Thank you!

Is there a way to force that thread to close, by adding any  
jackrabbit internal dependant code in my context listener close method?

-- 
Torgeir Veimo
torgeir@pobox.com




Re: permgen error with jackrabbit 1.1

Posted by Marcel Reutegger <ma...@gmx.net>.
Hi Torgeir,

There is a java.util.Timer deamon thread running in the background that prevents 
tomcat from garbage collecting the classes. I've created a jira issue:
http://issues.apache.org/jira/browse/JCR-600

I've however reproduced the issue a bit different. I deployed the 
jackrabbit-server.war in tomcat and then touched the web.xml file several times. 
After a while the JVM goes out of memory.

regards
  marcel

Torgeir Veimo wrote:
> I'm getting out of permgen space with jackrabbit running under tomcat 
> when the webapp has been reloaded enough times.
> 
> I've been trying to find the problem using jconsole, and it appears if I 
> do a session.login(); and session.logout(), then a good number of 
> classes will not be unloaded after the webapp has been reloaded. I'm 
> using TransientRepository and the following repository.xml file:
> 
> <Repository>
>     <FileSystem 
> class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
>         <param name="path" value="${rep.home}/repository"/>
>     </FileSystem>
>     <Security appName="Jackrabbit">
>         <AccessManager 
> class="org.apache.jackrabbit.core.security.SimpleAccessManager"/>
>         <LoginModule 
> class="org.apache.jackrabbit.core.security.SimpleLoginModule">
>            <!-- anonymous user name ('anonymous' is the default value) -->
>            <param name="anonymousId" value="anonymous"/>
>         </LoginModule>
>     </Security>
>     <Workspaces rootPath="${rep.home}/workspaces" 
> defaultWorkspace="default" />
>     <Workspace name="${wsp.name}">
>         <FileSystem 
> class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
>             <param name="path" value="${wsp.home}"/>
>         </FileSystem>
>         <PersistenceManager 
> class="org.apache.jackrabbit.core.state.xml.XMLPersistenceManager" />
>         <SearchIndex 
> class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
>             <param name="path" value="${wsp.home}/index"/>
>             <param name="autoRepair" value="true"/>
>             <param name="analyzer" 
> value="org.apache.lucene.analysis.standard.StandardAnalyzer"/>
>             <param name="textFilterClasses"
>                 
> value="org.apache.jackrabbit.core.query.HTMLTextFilter,org.apache.jackrabbit.core.query.XMLTextFilter"/> 
> 
>         </SearchIndex>
>     </Workspace>
>     <Versioning rootPath="${rep.home}/versions">
>         <FileSystem 
> class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
>             <param name="path" value="${rep.home}/versions"/>
>         </FileSystem>
>         <PersistenceManager 
> class="org.apache.jackrabbit.core.state.xml.XMLPersistenceManager" />
>     </Versioning>
> </Repository>
> 
> The code that is running and using Jackrabbit is limited to this:
> 
> String rootDirectory = (String) 
> ConfigManager.getEnvironmentEntry("jackrabbit/directory");
> String configFile = (String) 
> ConfigManager.getEnvironmentEntry("jackrabbit/configfile");
> 
> URL url = event.getServletContext().getResource(configFile);
> InputStream repositoryXml = 
> event.getServletContext().getResourceAsStream(configFile);
> RepositoryConfig config = RepositoryConfig.create(repositoryXml, 
> rootDirectory);
> repository = new TransientRepository(config);
> 
> Session session = repository.login();
> session.logout();
> 
> 
> --Torgeir Veimo
> torgeir@pobox.com
> 
> 
> 
>