Bug 52354 - Protect concurrent accesses to field "org.apache.catalina.tribes.transport.bio.util.FastQueue.inRemove"
Summary: Protect concurrent accesses to field "org.apache.catalina.tribes.transport.bi...
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Catalina (show other bugs)
Version: trunk
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-18 23:04 UTC by Mohsen Vakilian
Modified: 2011-12-24 00:10 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mohsen Vakilian 2011-12-18 23:04:53 UTC
Field "org.apache.catalina.tribes.transport.bio.util.FastQueue.inRemove" may be read and written in parallel. Thus, accesses to it should be synchronized. The following is a sequence of method calls from the "run" method of a class that implements "Runnable" to a method that accesses "FastQueue.inRemove" without proper synchronization.

1. org.apache.catalina.tribes.group.interceptors.MessageDispatchInterceptor.run()
2. org.apache.catalina.tribes.group.interceptors.MessageDispatchInterceptor.removeFromQueue()
3. org.apache.catalina.tribes.transport.bio.util.FastQueue.remove()

Field "FastQueue.inRemove" is declared at <http://svn.apache.org/repos/asf/!svn/bc/1220560/tomcat/trunk/java/org/apache/catalina/tribes/transport/bio/util/FastQueue.java>.
Comment 1 Mark Thomas 2011-12-23 21:06:21 UTC
There is a concurrency issue but not the one described here. Access to that field is protected by an exclusive lock. It does however need to be volatile.
Comment 2 Mark Thomas 2011-12-23 21:17:24 UTC
Fixed in trunk and 7.0.x and will be included in 7.0.24 onwards.
Comment 3 Mohsen Vakilian 2011-12-24 00:10:25 UTC
Thanks for resolving the visibility issue. Keshmesh <http://keshmesh.cs.illinois.edu/> detected this problem when we ran it on Tomcat using method "org.apache.catalina.tribes.group.interceptors.MessageDispatchInterceptor.run()" as an entry point.

(In reply to comment #2)
> Fixed in trunk and 7.0.x and will be included in 7.0.24 onwards.