java.lang.IllegalStateException: problem in scala.concurrent internal callback

Scala JIRA | Bruno Bieth | 3 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    [SI-8069] InternalCallbackExecutor does not handle failures properly - Scala

    scala-lang.org | 2 years ago
    java.lang.IllegalStateException: problem in scala.concurrent internal callback
  2. 0

    As reported in https://twitter.com/crichardson/status/391689178146418688 the following {code} scala.concurrent.Future{1} zip null {code} fails with : {code} java.lang.IllegalStateException: problem in scala.concurrent internal callback at scala.concurrent.Future$InternalCallbackExecutor$.reportFailure(Future.scala:589) at scala.concurrent.impl.CallbackRunnable.executeWithValue(Promise.scala:40) at scala.concurrent.impl.Promise$DefaultPromise.scala$concurrent$impl$Promise$DefaultPromise$$dispatchOrAddCallback(Promise.scala:280) at scala.concurrent.impl.Promise$DefaultPromise.onComplete(Promise.scala:270) at scala.concurrent.Future$class.zip(Future.scala:361) at scala.concurrent.impl.Promise$DefaultPromise.zip(Promise.scala:153) at org.backuity.photo.IndexerTest.ff(IndexerTest.scala:34) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) at org.junit.runners.ParentRunner.run(ParentRunner.java:300) at org.junit.runner.JUnitCore.run(JUnitCore.java:157) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:202) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:65) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) Caused by: java.lang.IllegalArgumentException: requirement failed at scala.Predef$.require(Predef.scala:221) at scala.concurrent.Future$InternalCallbackExecutor$Batch.run(Future.scala:628) at scala.concurrent.Future$InternalCallbackExecutor$.scala$concurrent$Future$InternalCallbackExecutor$$unbatchedExecute(Future.scala:691) at scala.concurrent.Future$InternalCallbackExecutor$Batch$$anonfun$run$1.processBatch$1(Future.scala:649) at scala.concurrent.Future$InternalCallbackExecutor$Batch$$anonfun$run$1.apply$mcV$sp(Future.scala:655) at scala.concurrent.Future$InternalCallbackExecutor$Batch$$anonfun$run$1.apply(Future.scala:632) at scala.concurrent.Future$InternalCallbackExecutor$Batch$$anonfun$run$1.apply(Future.scala:632) at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:72) at scala.concurrent.Future$InternalCallbackExecutor$Batch.run(Future.scala:631) at scala.concurrent.Future$InternalCallbackExecutor$.scala$concurrent$Future$InternalCallbackExecutor$$unbatchedExecute(Future.scala:691) at scala.concurrent.Future$InternalCallbackExecutor$.execute(Future.scala:682) ... 32 more {code} I took a quick look at it and this code seems suspicious (from 2.10.3 Future l.642): {code} case t: Throwable => // if one task throws, move the // remaining tasks to another thread // so we can throw the exception // up to the invoking executor val remaining = _tasksLocal.get _tasksLocal set Nil unbatchedExecute(new Batch(remaining)) throw t {code} The new Batch, executed in the same thread, will see non null `_tasksLocal` and fail, swallowing exception `t`.

    Scala JIRA | 3 years ago | Bruno Bieth
    java.lang.IllegalStateException: problem in scala.concurrent internal callback

    Root Cause Analysis

    1. java.lang.IllegalArgumentException

      requirement failed

      at scala.Predef$.require()
    2. Scala
      Promise$DefaultPromise.zip
      1. scala.Predef$.require(Predef.scala:221)
      2. scala.concurrent.Future$InternalCallbackExecutor$Batch.run(Future.scala:628)
      3. scala.concurrent.Future$InternalCallbackExecutor$.scala$concurrent$Future$InternalCallbackExecutor$$unbatchedExecute(Future.scala:691)
      4. scala.concurrent.Future$InternalCallbackExecutor$Batch$$anonfun$run$1.processBatch$1(Future.scala:649)
      5. scala.concurrent.Future$InternalCallbackExecutor$Batch$$anonfun$run$1.apply$mcV$sp(Future.scala:655)
      6. scala.concurrent.Future$InternalCallbackExecutor$Batch$$anonfun$run$1.apply(Future.scala:632)
      7. scala.concurrent.Future$InternalCallbackExecutor$Batch$$anonfun$run$1.apply(Future.scala:632)
      8. scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:72)
      9. scala.concurrent.Future$InternalCallbackExecutor$Batch.run(Future.scala:631)
      10. scala.concurrent.Future$InternalCallbackExecutor$.scala$concurrent$Future$InternalCallbackExecutor$$unbatchedExecute(Future.scala:691)
      11. scala.concurrent.Future$InternalCallbackExecutor$.execute(Future.scala:682)
      12. scala.concurrent.Future$InternalCallbackExecutor$.reportFailure(Future.scala:589)
      13. scala.concurrent.impl.CallbackRunnable.executeWithValue(Promise.scala:40)
      14. scala.concurrent.impl.Promise$DefaultPromise.scala$concurrent$impl$Promise$DefaultPromise$$dispatchOrAddCallback(Promise.scala:280)
      15. scala.concurrent.impl.Promise$DefaultPromise.onComplete(Promise.scala:270)
      16. scala.concurrent.Future$class.zip(Future.scala:361)
      17. scala.concurrent.impl.Promise$DefaultPromise.zip(Promise.scala:153)
      17 frames
    3. org.backuity.photo
      IndexerTest.ff
      1. org.backuity.photo.IndexerTest.ff(IndexerTest.scala:34)
      1 frame
    4. Java RT
      DelegatingMethodAccessorImpl.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      3 frames
    5. JUnit
      JUnitCore.run
      1. org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
      2. org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
      3. org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
      4. org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
      5. org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
      6. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
      7. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
      8. org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
      9. org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
      10. org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
      11. org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
      12. org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
      13. org.junit.runners.ParentRunner.run(ParentRunner.java:300)
      14. org.junit.runner.JUnitCore.run(JUnitCore.java:157)
      14 frames
    6. IntelliJ junit4 module
      JUnit4IdeaTestRunner.startRunnerWithArgs
      1. com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74)
      1 frame
    7. IDEA
      JUnitStarter.main
      1. com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:202)
      2. com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:65)
      2 frames
    8. Java RT
      NativeMethodAccessorImpl.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      2 frames
    9. IDEA
      AppMain.main
      1. com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
      1 frame