You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by bu...@apache.org on 2003/08/18 15:19:38 UTC
DO NOT REPLY [Bug 22513] New: -
Scope "leaks" using multiple sessions using new flow framework
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22513>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22513
Scope "leaks" using multiple sessions using new flow framework
Summary: Scope "leaks" using multiple sessions using new flow
framework
Product: Cocoon 2
Version: 2.1
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: Major
Priority: Other
Component: core
AssignedTo: dev@cocoon.apache.org
ReportedBy: g.brand@interface-business.de
Using the new flow framework I encountered numerous null pointer exceptions
using the cocoon object's getComponent. This only
happened if more than _one_ session accessed the application.
After adding a lot of debug messages to the FOM_* classes I noticed that the
FOM_Cocoon instance changed in the flow script.
After 2 days of tracing I finally found what causes the problem:
I am using javascript objects in my application and somehow the scope changes
to the scope created by the latest session. This
scope then is used in _all_ sessions. Obviously all but the last sessions fail,
because the FOM_Cocoon object is invalidated
when it is not used, i.e. all internal references are null.
(When I overloaded the get method in FOM_JavaScriptInterpreter.ThreadScope and
added a debug message, I could see that the 2nd
argument (the threadScope instance) suddenly changes. I suspect that the top
level scope is somehow used for all sessions.)
You can reproduce the problem with the attached simple test script.
It displays the global "application" and "cocoon" object's hashcodes.
One time called from the global function test() and the other time from inside
the application object.
If you have two or more browser windows open, the first will display something
like this:
global
stats(): application.hash = 2829043
application = 2829043
cocoon = 22342265
application
Application.stats(): this.hash = 2829043
this.cocoon = 22342265 --> calling stats():
stats(): application.hash = 2829043
application = 2829043
cocoon = 22342265
-------------------------------------------------------------------
And if you load the same application in the second window:
global
stats(): application.hash = 9089012
application = 9089012
cocoon = 19257644
application
Application.stats(): this.hash = 9089012
this.cocoon = 19257644 --> calling stats():
stats(): application.hash = 9089012
application = 9089012
cocoon = 19257644
--------------------------------------------------------------------
Once you press continue in the first window you get the unexpected result:
global
stats(): application.hash = 2829043
application = 2829043
cocoon = 22342265
application
Application.stats(): this.hash = 2829043
this.cocoon = 22342265 --> calling stats():
stats(): application.hash = 9089012
application = 9089012
cocoon = 19257644
As you can see the scope changes and stays this way for every called function
or method. It doesn't matter if I call stats()
from Application.stats() or output the values directly, both report the wrong
ones (inside the Application object this!=
application and cocoon is invalid).
Obviously this error does not occur until one is using javascript objects in
the flow scripts.
I don't know if that is the same reason for the npes I had with the old flow
engine now and then.
I am using Cocoon 2.1 and JDK 1.4.1_03.
Gunnar