tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Remy Maucherat <r...@apache.org>
Subject Re: DO NOT REPLY [Bug 36541] - session getAttribute/setAttribute and removeAttribute are NOT Thread safe.
Date Thu, 08 Sep 2005 00:04:44 GMT
Mark Thomas wrote:
> Remy Maucherat wrote:
> 
> Indeed. But do we need to sync the reads in 5.5.x as well or is it 
> enough just to do the writes? I am confused as you said concurrent reads 
> were the issue but syncing the writes would fix it.

No, concurrent reads are not the issue. The problem is that when the 
HashMap structure is corrupted by concurrent writes (either a put 
causing a resize, or a remove), then any read might loop. I believe as 
long as the HashMap structure remains consistent, all the next fields 
for the entries (which is the problematic field) will have a correct 
value at the end of the resize/remove, so an infinite loop on get is 
then not possible.

What this issue tells me, also, is that using the default size for the 
attributes HashMap may be inappropriate (it is best to avoid resizes, 
and the question is how much they happen - if at all, maybe it is remove 
which is most often used).

> Sorry if I am being dense here ;)

No problem :)

Rémy

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


Mime
View raw message