New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fail to Recover Remaining Tasks in BatchExecutor #8689
Comments
Imported From: https://issues.scala-lang.org/browse/SI-8689?orig=1
|
Viktor Klang (viktorklang) said (edited on Oct 10, 2014 9:27:40 AM UTC): Isn't the only way to get that requirement failure is if you execute the new Batch synchronously in unbatchedExecute? Do you have a reproducer for this issue? |
satyagraha said: I think the expected program effects are correct in this case, it's more that the thread attempting to complete the previously completed promise gets broken. BTW it does something similar with the Akka execution context, though the traceback is slightly different. |
Viktor Klang (viktorklang) said: may I ask you minimize the reproducer? (i.e. removing all code that isn't needed to reproduce the problem) Thank you! |
satyagraha said: |
Viktor Klang (viktorklang) said (edited on Dec 17, 2014 9:00:16 PM UTC): I managed to minimize it a bit further, I can reproduce your problem locally. package org.anomaly
object AnomalyApp3 extends App {
import scala.concurrent._
import ExecutionContext.Implicits.global
val source1 = Promise[Int]()
val source2 = Promise[Int]()
source2.completeWith(source1.future).future.onComplete {
case completion => print(s"source2 completed with: ${completion}")
}
source2.tryFailure(new TimeoutException)
source1.success(123)
} |
Viktor Klang (viktorklang) said: |
satyagraha said: |
Viktor Klang (viktorklang) said: I just added some more tests to completeWith and tryCompleteWith to the PR, and introduced a new commit which deprecates |
In scala.concurrent.BatchExecutor$Batch.run() of Scala 2.11.1.
If
head.run()
BatchingExecutor.scala(63) throws a exception, remaining tasks will attempt to execute. Butrequire(_tasksLocal.get eq null)
at the beginning of theBatch.run()
that is called recursively fromunbatchedExecute()
will always fail because it set theNil
to_tasksLocal
here.This hides the original cause.
_tasksLocal
shouldremove()
because the remaining tasks are passed as an argument.java.lang.IllegalStateException: problem in scala.concurrent internal callback
at scala.concurrent.Future$InternalCallbackExecutor$.reportFailure(Future.scala:601)
at scala.concurrent.impl.CallbackRunnable.executeWithValue(Promise.scala:40)
at scala.concurrent.impl.Promise$DefaultPromise.tryComplete(Promise.scala:248)
at scala.concurrent.Promise$class.complete(Promise.scala:55)
at scala.concurrent.impl.Promise$DefaultPromise.complete(Promise.scala:153)
at scala.concurrent.Future$$anonfun$map$1.apply(Future.scala:235)
at scala.concurrent.Future$$anonfun$map$1.apply(Future.scala:235)
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32)
at scala.concurrent.impl.ExecutionContextImpl$AdaptedForkJoinTask.exec(ExecutionContextImpl.scala:121)
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.pollAndExecAll(ForkJoinPool.java:1253)
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1346)
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Caused by: java.lang.IllegalArgumentException: requirement failed
at scala.Predef$.require(Predef.scala:207)
at scala.concurrent.BatchingExecutor$Batch.run(BatchingExecutor.scala:51)
at scala.concurrent.Future$InternalCallbackExecutor$.unbatchedExecute(Future.scala:599)
at scala.concurrent.BatchingExecutor$Batch$$anonfun$run$1.processBatch$1(BatchingExecutor.scala:72)
at scala.concurrent.BatchingExecutor$Batch$$anonfun$run$1.apply$mcV$sp(BatchingExecutor.scala:78)
at scala.concurrent.BatchingExecutor$Batch$$anonfun$run$1.apply(BatchingExecutor.scala:55)
at scala.concurrent.BatchingExecutor$Batch$$anonfun$run$1.apply(BatchingExecutor.scala:55)
at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:72)
at scala.concurrent.BatchingExecutor$Batch.run(BatchingExecutor.scala:54)
at scala.concurrent.Future$InternalCallbackExecutor$.unbatchedExecute(Future.scala:599)
at scala.concurrent.BatchingExecutor$class.execute(BatchingExecutor.scala:106)
at scala.concurrent.Future$InternalCallbackExecutor$.execute(Future.scala:597)
... 13 more
The text was updated successfully, but these errors were encountered: