Skip to content

Using ThreadPoolTaskSupport causes test to hang #7236

Closed
@scabug

Description

@scabug

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:

{code}
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
{code}

If I change that to just
{code}
       private[parallel] def getTaskSupport: TaskSupport = new ForkJoinTaskSupport
{code}

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

{code}
       private[parallel] def getTaskSupport: TaskSupport = new ThreadPoolTaskSupport
{code}

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions