Uploaded image for project: 'Commons Pool'
  1. Commons Pool
  2. POOL-215

GenericKeyedObjectPool - multiple mutable fields not published safely

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.0
    • None

    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)

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            sebb Sebb
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment