You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sebb (JIRA)" <ji...@apache.org> on 2012/04/27 15:21:48 UTC

[jira] [Created] (POOL-215) GenericKeyedObjectPool - multiple mutable fields not published safely

Sebb created POOL-215:
-------------------------

             Summary: GenericKeyedObjectPool - multiple mutable fields not published safely
                 Key: POOL-215
                 URL: https://issues.apache.org/jira/browse/POOL-215
             Project: Commons Pool
          Issue Type: Bug
            Reporter: Sebb


The GenericKeyedObjectPool has multiple mutable instance fields that are neither volatile nor protected by syncronisation.
This means that updates by one thread may not be seen by other threads.

The following fields should either be made volatile, or be protected by a lock.
The lock is more suitable if the main usage is already protected by a lock.

blockWhenExhausted
evictionPolicy (getter and setter should use evictionLock)
lifo
maxIdlePerKey
maxTotal
maxTotalPerKey
maxWait
minEvictableIdleTimeMillis (getter and setter should use evictionLock)
numTestsPerEvictionRun (getter and setter should use evictionLock)
testWhileIdle (getter and setter should use evictionLock)

Note that where the same fields appear in GOP, they are protected (apart from evictionPolicy, see POOL-214)

timeBetweenEvictionRunsMillis is not thread-safe, but does not appear to be used.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (POOL-215) GenericKeyedObjectPool - multiple mutable fields not published safely

Posted by "Mark Thomas (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/POOL-215?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Thomas resolved POOL-215.
------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0

Fixed in the refactoring to use BaseGenericObjectPool. All issues were fixed using volatile rather than the eviction lock since that lock may be held for relatively long periods of time and that should not block getters/setters.
                
> GenericKeyedObjectPool - multiple mutable fields not published safely
> ---------------------------------------------------------------------
>
>                 Key: POOL-215
>                 URL: https://issues.apache.org/jira/browse/POOL-215
>             Project: Commons Pool
>          Issue Type: Bug
>            Reporter: Sebb
>             Fix For: 2.0
>
>
> The GenericKeyedObjectPool has multiple mutable instance fields that are neither volatile nor protected by syncronisation.
> This means that updates by one thread may not be seen by other threads.
> The following fields should either be made volatile, or be protected by a lock.
> The lock is more suitable if the main usage is already protected by a lock.
> blockWhenExhausted
> evictionPolicy (getter and setter should use evictionLock)
> lifo
> maxIdlePerKey
> maxTotal
> maxTotalPerKey
> maxWait
> minEvictableIdleTimeMillis (getter and setter should use evictionLock)
> numTestsPerEvictionRun (getter and setter should use evictionLock)
> testWhileIdle (getter and setter should use evictionLock)
> timeBetweenEvictionRunsMillis (getter and setter should use evictionLock)
> Note that where the same fields appear in GOP, they are protected (apart from evictionPolicy, see POOL-214)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (POOL-215) GenericKeyedObjectPool - multiple mutable fields not published safely

Posted by "Sebb (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/POOL-215?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb updated POOL-215:
----------------------

    Description: 
The GenericKeyedObjectPool has multiple mutable instance fields that are neither volatile nor protected by syncronisation.
This means that updates by one thread may not be seen by other threads.

The following fields should either be made volatile, or be protected by a lock.
The lock is more suitable if the main usage is already protected by a lock.

blockWhenExhausted
evictionPolicy (getter and setter should use evictionLock)
lifo
maxIdlePerKey
maxTotal
maxTotalPerKey
maxWait
minEvictableIdleTimeMillis (getter and setter should use evictionLock)
numTestsPerEvictionRun (getter and setter should use evictionLock)
testWhileIdle (getter and setter should use evictionLock)
timeBetweenEvictionRunsMillis (getter and setter should use evictionLock)

Note that where the same fields appear in GOP, they are protected (apart from evictionPolicy, see POOL-214)

  was:
The GenericKeyedObjectPool has multiple mutable instance fields that are neither volatile nor protected by syncronisation.
This means that updates by one thread may not be seen by other threads.

The following fields should either be made volatile, or be protected by a lock.
The lock is more suitable if the main usage is already protected by a lock.

blockWhenExhausted
evictionPolicy (getter and setter should use evictionLock)
lifo
maxIdlePerKey
maxTotal
maxTotalPerKey
maxWait
minEvictableIdleTimeMillis (getter and setter should use evictionLock)
numTestsPerEvictionRun (getter and setter should use evictionLock)
testWhileIdle (getter and setter should use evictionLock)

Note that where the same fields appear in GOP, they are protected (apart from evictionPolicy, see POOL-214)

timeBetweenEvictionRunsMillis is not thread-safe, but does not appear to be used.


Did not spot that the value was actually used in the setter, rather than the getter.
                
> GenericKeyedObjectPool - multiple mutable fields not published safely
> ---------------------------------------------------------------------
>
>                 Key: POOL-215
>                 URL: https://issues.apache.org/jira/browse/POOL-215
>             Project: Commons Pool
>          Issue Type: Bug
>            Reporter: Sebb
>
> The GenericKeyedObjectPool has multiple mutable instance fields that are neither volatile nor protected by syncronisation.
> This means that updates by one thread may not be seen by other threads.
> The following fields should either be made volatile, or be protected by a lock.
> The lock is more suitable if the main usage is already protected by a lock.
> blockWhenExhausted
> evictionPolicy (getter and setter should use evictionLock)
> lifo
> maxIdlePerKey
> maxTotal
> maxTotalPerKey
> maxWait
> minEvictableIdleTimeMillis (getter and setter should use evictionLock)
> numTestsPerEvictionRun (getter and setter should use evictionLock)
> testWhileIdle (getter and setter should use evictionLock)
> timeBetweenEvictionRunsMillis (getter and setter should use evictionLock)
> Note that where the same fields appear in GOP, they are protected (apart from evictionPolicy, see POOL-214)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira