Uploaded image for project: 'Scala Programming Language'
  1. Scala Programming Language
  2. SI-6136

LinkedTransferQueue.size() Liveness Hazard


    • Type: Bug
    • Status: CLOSED
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: Scala 2.9.1, Scala 2.9.2
    • Fix Version/s: Scala 2.10.1, Scala 2.11.0-M5
    • Component/s: None
    • Labels:
    • Environment:

      Scala 2.9.1 / 2.9.2. (Not environment-specific, but observed on 2.6.32-38-generic #83-Ubuntu SMP x86_64 and Mac OS X Snow Leopard x64, Java 1.6.0_30-b12). One a quad-core box with HT, the other a 12-core with HT.



      There appears to be an issue with the version of the JSR166 LinkedTransferQueue that ships with Scala 2.9.2 (also confirmed under 2.9.1) that can result in calls to LTQ.size() spinning infinitely and failing to return. This issue does not occur when using the latest version of LinkedTransferQueue in JSR166y.

      We've run into this issue in production at Boundary a few times and finally sat down to reproduce it. Fortunately, it is very easy to trigger and has been fixed upstream in the JSR166 project.

      Steps to reproduce in Scala 2.9.2:
      1. Run the attached "Repro.scala" sample program with: scala Repro.scala
      2. Observe output similar to bug-reproduced.txt (attached)
      3. Notice that calls to .size() stop increasing as the call does not return.

      Steps to demonstrate success with the latest version of JSR166:
      1. Fetch the latest JSR166 at http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166y.jar
      2. Replace "import scala.concurrent.forkjoin.LinkedTransferQueue" with
      "import jsr166y.LinkedTransferQueue" in Repro.scala below.
      3. Run the "Repo.scala" sample program with: scala -cp jsr166y.jar Repro.scala
      4. Observe output similar to bug-resolved.txt (attached)

      If possible, I would recommend upgrading this package (or at least LinkedTransferQueue) to the latest available release of JSR166.


      Scott Andreas

      NB: This report and the following attachments can also be viewed as a Gist for your convenience: https://gist.github.com/3025111




            • Assignee:
              retronym Jason Zaugg
              cscotta C. Scott Andreas
            • Votes:
              0 Vote for this issue
              8 Start watching this issue


              • Created: