tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris R <>
Subject Race condition in DefaultServlet
Date Wed, 27 Jun 2012 16:33:01 GMT

I am looking at the tomcat DefaultServlet code and I am afraid there seems
to be a race condition in there.

>From doPut(...), there is a call to resources.lookup(path).
>From resources.lookup(...), there is a call to cacheLookup(name).
Within cacheLookup(..), there is a call to cache.lookup(name)
And in cache.lookup(...), accessCount, an instance variable is incremented.

If multiple threads call doPut(...), there is a possibility that they can
clobber each other and the value of
accessCount may not really give the exact number of accesses of the cache.
Can someone confirm whether this is a real problem?
How about adding a synchronization before this is updated?


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message