You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Peter Klein <ko...@gmx.de> on 2004/10/28 11:21:16 UTC

Concurrency problem: 2 Engines created for one HttpSession

Hi. 

I've tried to find a solution to this problem on the Web and in the
archives, but could not find anything, so I've decided to describe my
problem on this list.

As far as I understand, the class ApplicationServlet will create Engine
objects for an application as needed, using a pool to store Engines that are
not associated with a Session. On the other hand, each Session can be
assigned one Engine.

Now, in my application, I have the problem that sometimes, this assignment
happens twice, where the new Session overwrites the old one, and therefore I
lose the data in the first Engine.


This seems to be a concurrency problem. I've tracked it down so far:

1. (Thread One) ApplicationServlet.doService() is called with a request that
is not associated with a Session.

2. (Thread One) getEngine() determines that a new engine is needed and
creates Engine One. (line 379).

3. (Thread One) Engine.service() creates a Session named Session One and
sends the response back to the client. The response contains a cookie, and
also references an Asset.

4. (Thread Two) ApplicationServlet.doService() is called with a request for
the Asset. The request references the Session.

5. (Thread Two) getEngine() retrieves Session One. It determines that a new
engine is needed and creates Engine Two. (line 379)

6. (Thread Two) Engine.service() retrieves the asset and sends the response
back to the client.

7. (Thread One) ApplicationServlet.doService() sets Engine One into Session
One.

8. (Thread Two) ApplicationServlet.doService() sets Engine Two into Session
One.

Has anybody else encountered this behavior, and are there any solutions to
this problem?
Is this an application error or a Tapestry bug?

Thanks.

Peter Klein


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Concurrency problem: 2 Engines created for one HttpSession

Posted by Peter Klein <ko...@gmx.de>.
Peter Klein wrote:

>Hi. 
>
>I've tried to find a solution to this problem on the Web and in the
>archives, but could not find anything, so I've decided to describe my
>problem on this list.
>
>....
>

I just found out that my problem was already reported:
    http://issues.apache.org/jira/browse/TAPESTRY-169

Nevermind. I'll have a look into how this can be fixed then.

Peter



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org