Scala Programming Language
  1. Scala Programming Language
  2. SI-7236

Using ThreadPoolTaskSupport causes test to hang

    Details

      Description

      While Joel and I bootstrapped and tested Scala on Avian, we both encountered that the test suite hangs in test/files/scalacheck/parallel-collections.

      This seems to be an issue on Scala's side: Joel discovered that the same also happens on Hotspot when using ThreadPoolTaskSupport:

      Nevermind, I figured it out. There's a lovely bit of code in scala/collection/parallel/package.scala:

      private[parallel] def getTaskSupport: TaskSupport =
        if (scala.util.Properties.isJavaAtLeast("1.6")) {
          val vendor = scala.util.Properties.javaVmVendor
          if ((vendor contains "Oracle") || (vendor contains "Sun") || (vendor contains "Apple")) new ForkJoinTaskSupport
          else new ThreadPoolTaskSupport
        } else new ThreadPoolTaskSupport
      

      If I change that to just

             private[parallel] def getTaskSupport: TaskSupport = new ForkJoinTaskSupport
      

      the parallel-collections test passes on Avian and HotSpot. However, if I change it to

             private[parallel] def getTaskSupport: TaskSupport = new ThreadPoolTaskSupport
      

      it hangs on both Avian and HotSpot. In other words, the test simply won't complete when using ThreadPoolTaskSupport, regardless of the VM, which means the test can only pass if the VM vendor is Oracle, Sun, or Apple.

      Ouch.

      It looks like ThreadPoolTaskSupport is broken on all VMs.

      Thread on the Avian mailing list: https://groups.google.com/d/msg/avian/Hugny4JcnDw/shb3r-3BOR8J

      Thread on the Scala mailing list: https://groups.google.com/d/msg/scala-internals/7N-7HzoH8tM/9mx4bZd4JfoJ

      Joel's thread dump is attached.

      I'll open a separate issue for the insufficient task support detection mechanism.

        Issue Links

          Activity

          Hide
          Simon Ochsenreither added a comment -

          IBM J9 also hangs with ThreadPoolTaskSupport.

          Show
          Simon Ochsenreither added a comment - IBM J9 also hangs with ThreadPoolTaskSupport.
          Hide
          Simon Ochsenreither added a comment -

          Deprecate ThreadPoolTaskSupport and friends.

          2.11: https://github.com/scala/scala/pull/2251

          Show
          Simon Ochsenreither added a comment - Deprecate ThreadPoolTaskSupport and friends. 2.11: https://github.com/scala/scala/pull/2251
          Hide
          James Iry added a comment -

          I'm leaving open for 2.12 to remind us to delete.

          Show
          James Iry added a comment - I'm leaving open for 2.12 to remind us to delete.
          Hide
          Simon Ochsenreither added a comment - - edited

          Merged in https://github.com/scala/scala/commit/27f3a896cdc513817b1e0ed8195880cd3cfe42e5

          I'm closing this, because I created an explicit new ticket for removals in 2.12: https://issues.scala-lang.org/browse/SI-7566

          Show
          Simon Ochsenreither added a comment - - edited Merged in https://github.com/scala/scala/commit/27f3a896cdc513817b1e0ed8195880cd3cfe42e5 I'm closing this, because I created an explicit new ticket for removals in 2.12: https://issues.scala-lang.org/browse/SI-7566

            People

            • Assignee:
              Simon Ochsenreither
              Reporter:
              Simon Ochsenreither
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development