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

GOP/GKOP evict() method is not synchronised and is not thread-safe

    XMLWordPrintableJSON

Details

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

    Description

      The evict() method in Pool2 GOP/GKOP classes is not synchronised, yet it relies on accessing and updating the field evictionIterator without any synchronisation.

      Adding volatile to the field would help with safe publication across threads, but won't address the problem of two evictions running in parallel.

      AFAICT, two threads running evict() in parallel could operate on the same objects, which will almost certainly cause problems.

      The evict() method should probably be synchronised, which would also solve the safe publication problem.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: