Bug 110613 - Both BaseServlet & BaseFilter run Startup#run causing the same session to be configured
Summary: Both BaseServlet & BaseFilter run Startup#run causing the same session to be ...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Web Application Framework
Classification: Retired
Component: other
Version: nightly
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Richard Li
QA Contact: Jon Orris
URL:
Whiteboard:
Depends On:
Blocks: 106481
TreeView+ depends on / blocked
 
Reported: 2003-11-21 18:43 UTC by Daniel Berrangé
Modified: 2007-04-18 16:59 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2004-01-26 21:40:25 UTC
Embargoed:


Attachments (Terms of Use)
Logs from startup sequence (25.14 KB, text/plain)
2004-01-07 17:53 UTC, Daniel Berrangé
no flags Details

Description Daniel Berrangé 2003-11-21 18:43:35 UTC
Description of problem:
In static {} blocks of BaseServlet and BaseFilter, there is the
following code:

        if (!SessionManager.hasSession("default")) {
            new Startup().run();
        }

The 'hasSession' method looks in the Map returned by getSessions(),
however. This entries in this map are created when SessionManager#open
is invoked. Unfortuntely, the Startup#run method only ever invokes
SessionManager#configure so the map is never populated.

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. Run
        if (!SessionManager.hasSession("default")) {
            new Startup().run();
        }
        if (!SessionManager.hasSession("default")) {
            new Startup().run();
        }

Yes, twice in a row.

2.
3.
  
Actual results:
java.lang.ExceptionInInitializerError: java.lang.IllegalArgumentException:
already configured: startup
	at
com.arsdigita.persistence.SessionManager.configure(SessionManager.java:98)
	at com.arsdigita.runtime.Startup.session(Startup.java:179)
	at
com.arsdigita.runtime.Startup.getRuntimeInitializerNames(Startup.java:144)
	at com.arsdigita.runtime.Startup.addRuntimeInitializers(Startup.java:123)
	at com.arsdigita.runtime.Startup.run(Startup.java:226)
	at com.arsdigita.web.BaseFilter.<clinit>(BaseFilter.java:57)
	at java.lang.Class.newInstance0(Native Method)
	at java.lang.Class.newInstance(Class.java(Compiled Code))
	at
com.caucho.server.http.QFilterConfig.createFilter(QFilterConfig.java:205)
	at
com.caucho.server.http.Application.buildFilterChain(Application.java:2862)
	at
com.caucho.server.http.Application.buildFilterChain(Application.java:2764)
	at com.caucho.server.http.Invocation.service(Invocation.java:313)
	at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:246)
	at
com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:163)
	at com.caucho.server.TcpConnection.run(TcpConnection.java:139)
	at java.lang.Thread.run(Thread.java:513)

Expected results:

The second call to Startup#run is never done, since SessionManager
already has the default session configured.

Additional info:

Comment 1 Daniel Berrangé 2003-11-27 18:32:51 UTC
I've had to temporarily disable the 'static' initializer in BaseFilter
(p4 38355) untill this is resolve, since it is blocking successful
startup.

Comment 2 Vadim Nasardinov 2003-12-09 20:50:51 UTC
Note for Jon if/when he gets around to testing this:

BaseFilter has zero (0) afferent dependencies in Core+CMS.
See bug 99096, comment #3.

Comment 3 Daniel Berrangé 2003-12-10 09:54:03 UTC
BaseFilter is used by PS code. Its purpose is similar to BaseServlet,
in that it ensures that persistence session is initialized before the
body of the filter is run.


Comment 4 Richard Li 2004-01-06 18:55:48 UTC
fixed @39141

Comment 5 Daniel Berrangé 2004-01-07 17:53:23 UTC
This has broken the CCM load command. The problem is that 's_hasRun'
is set at the end of the run method, however, one of the initializers
for CMS causes ContentItem class to be loaded, which in turn loads the
BaseServlet classs, which in turn checks the s_hasRun attribute -
which is still false & so it calls run again - recursively.

This is trivally fixed by moving 's_hasRun = true' to the start of the
method.

Comment 6 Daniel Berrangé 2004-01-07 17:53:40 UTC
Created attachment 96808 [details]
Logs from startup sequence

Comment 7 Richard Li 2004-01-08 16:47:05 UTC
Ah, fixed @39202.


Note You need to log in before you can comment on or make changes to this bug.