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

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Labels:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: