https://issues.apache.org/bugzilla/show_bug.cgi?id=49778
Summary: Inconsistent synchronization in SimplePool.java
Product: Tomcat 6
Version: 6.0.18
Platform: All
OS/Version: All
Status: NEW
Severity: major
Priority: P2
Component: Catalina
AssignedTo: [email protected]
ReportedBy: [email protected]
In class org.apache.tomcat.util.collections.SimplePool, current is a mutable
field. In method put/get, current field is updated with a lock held. But in
method getCount(), the access to current field is not protected by a lock.
In current Java memory model, the up-to-date current field value is not
guaranteed to be seen in the absence of synchronization. So getCount() method
can return a stale or inconsistent value, which results in undesired behavior.
Proposed solution:
public int getCount() {
int ret = 0;
synchronized (lock) {
ret = current+1;
}
return ret;
}
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]