I am attempting to find a solid workaround for the memory leak of Subjects, which is bug GERONIMO-5800.

Background:

We have a JSF 1.2/Facelets web application, which uses FORM authentication with a SQL Database security realm.

We logout users using a Filter, and so whenever a specific 'logout.faces' page is called, we do a simple invalidate of the session:

HttpSession session = httpServletRequest.getSession(false);
if (session != null) {
session.invalidate();
}

Workaround Attempts:

I tried adding the code suggested by David Jencks like this:

HttpSession session = httpServletRequest.getSession(false);
if (session != null) {
session.invalidate();
}
Subject subject = ContextManager.getCurrentCaller();
ContextManager.unregisterSubject(subject);

That code ran without errors, but afterwards it caused EJB JNDI lookup errors on subsequent pages.

Instead of unregistering the Subject, I can change it to simply ContextManager.clearCallers() and that runs without any errors at all.  I'm just not sure if that will resolve the memory leak issue.

Questions:

1. Does anyone know if simply calling clearCallers() should address the memory leak issue.
2. Does anyone have any ideas on what else I should try?  I'm willing to change any part of our design in order to address this problem.  Currently, we are restarting our server weekly to avoid out of memory errors.

Thank you for any consideration you can provide.

David Frahm
Huber & Associates

Office: 573-634-5000, Mobile: 573-298-1040