tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Karl San Gabriel <>
Subject Re: Re: session.isNew() not thread safe?
Date Mon, 02 Mar 2009 18:40:37 GMT
Hi Jakob,

Session object is not thread-safe. It's better put the session object in 
a synchronized block.

Karl San Gabriel

Tim Funk wrote:
> <div class="moz-text-flowed" style="font-family: -moz-fixed">Sort of 
> (if I read the code correctly)
> isNew is set to false after the response is finished. So if you have 2 
> concurrent requests running, isNew is true until the first request 
> finishes sending its response back to the client. Of course isNew 
> could be set to false if the second request finishes its response 
> faster than the first request. In which case, the first request could 
> have isNew set=true only later have it be set to be false.
> -Tim
> Jakob Ericsson wrote:
>  > Our feeling is that this is a race condition between threads before
>> tomcat set isNew to false.
>> A quick workaround is to use request.getSession(false) and null
>> checks. This seems to get us around our specific application problem.
>> Could this be a problem in Tomcat?
> </div>

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message