tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject DO NOT REPLY [Bug 49778] New: Inconsistent synchronization in
Date Thu, 19 Aug 2010 08:59:46 GMT

           Summary: Inconsistent synchronization in
           Product: Tomcat 6
           Version: 6.0.18
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: Catalina

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:
------- You are receiving this mail because: -------
You are the assignee for the bug.

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

View raw message