You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Kaspar Fischer <fi...@inf.ethz.ch> on 2008/10/16 18:02:04 UTC

Threading problem

I run into a concurrency issue: My pages load fine when I visit
them slowly, one after the other with a pause between clicks.
However, if I click on two links on my page very, very fast, an
exception gets thrown.

My session factory outputs the number of the thread and the hash
code of the session created (in chronological order):

   [89213] New Session@bf9e37.
   [11349856] New Session@43f1c.

And after that, thread 89213 throws an exception:

   Access in thread 89213 to data in session @43f1c from a different  
thread (11349856)!

It seems that thread 89213 is accessing a session that was created
*later*. How can something like this happen in Wicket when it
handles requests (from a single session) sequentially? Any ideas?

Thanks for any pointer,
Kaspar

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Threading problem

Posted by Kaspar Fischer <fi...@inf.ethz.ch>.
Thank you very much for this explanation, Igor. Very much appreciated.  
- Kaspar

On 16.10.2008, at 18:14, Igor Vaynberg wrote:

> requests from a single session are serialized. but what if your page  
> is
> stateless and you click the two links fast?
>
> each click spins off a request that now needs a session and because  
> they run
> concurrently two sessions are created because this is the first  
> request that
> needs a session.
>
> try doing this in your page's constructor: Session.get().bind();  
> this will
> force wicket to create a http session when the page renders and will  
> avoid
> this kind of problem.
>
> -igor
>
> On Thu, Oct 16, 2008 at 9:02 AM, Kaspar Fischer  
> <fi...@inf.ethz.ch>wrote:
>
>> I run into a concurrency issue: My pages load fine when I visit
>> them slowly, one after the other with a pause between clicks.
>> However, if I click on two links on my page very, very fast, an
>> exception gets thrown.
>>
>> My session factory outputs the number of the thread and the hash
>> code of the session created (in chronological order):
>>
>> [89213] New Session@bf9e37.
>> [11349856] New Session@43f1c.
>>
>> And after that, thread 89213 throws an exception:
>>
>> Access in thread 89213 to data in session @43f1c from a different  
>> thread
>> (11349856)!
>>
>> It seems that thread 89213 is accessing a session that was created
>> *later*. How can something like this happen in Wicket when it
>> handles requests (from a single session) sequentially? Any ideas?
>>
>> Thanks for any pointer,
>> Kaspar
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Threading problem

Posted by Igor Vaynberg <ig...@gmail.com>.
requests from a single session are serialized. but what if your page is
stateless and you click the two links fast?

each click spins off a request that now needs a session and because they run
concurrently two sessions are created because this is the first request that
needs a session.

try doing this in your page's constructor: Session.get().bind(); this will
force wicket to create a http session when the page renders and will avoid
this kind of problem.

-igor

On Thu, Oct 16, 2008 at 9:02 AM, Kaspar Fischer <fi...@inf.ethz.ch>wrote:

> I run into a concurrency issue: My pages load fine when I visit
> them slowly, one after the other with a pause between clicks.
> However, if I click on two links on my page very, very fast, an
> exception gets thrown.
>
> My session factory outputs the number of the thread and the hash
> code of the session created (in chronological order):
>
>  [89213] New Session@bf9e37.
>  [11349856] New Session@43f1c.
>
> And after that, thread 89213 throws an exception:
>
>  Access in thread 89213 to data in session @43f1c from a different thread
> (11349856)!
>
> It seems that thread 89213 is accessing a session that was created
> *later*. How can something like this happen in Wicket when it
> handles requests (from a single session) sequentially? Any ideas?
>
> Thanks for any pointer,
> Kaspar
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>