Skip to content
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

Revise deadlock detection #22

Open
Sipkab opened this issue Jul 4, 2020 · 3 comments
Open

Revise deadlock detection #22

Sipkab opened this issue Jul 4, 2020 · 3 comments

Comments

@Sipkab
Copy link
Member

Sipkab commented Jul 4, 2020

The deadlock detection mechanism of saker.build depends on the ThreadGroup API. The code itself is not really robust as lingering threads may cause the deadlock not to be noticed. Additionally, the issue #2 is also a side effect of the current mechanism.

As per https://mail.openjdk.java.net/pipermail/loom-dev/2020-July/001471.html, the intetion for the ThreadGroup API is to be deprecated over time. It also includes heavy synchronization and may not be reliable enough for proper use for deadlock detection. The solution for this is to revise the current implementation and come up with some different mechanism for deadlock detection. This may include placing additional restrictions on the build tasks.

One solution might be is to only allow waiting for other tasks on the main thread of a task. The main thread is the one that Task.run() is invoked on. This could make it easier to detect the deadlocks as only a single thread needs to be kept in check for the detection.

In order for this to work additional APIs may need to be added to allow waiting for multiple tasks at once. Existing task implementations also need to be checked and tested to be conforming.

With this solution the build will be considered as deadlocked if all running main threads are in waiting state.

This would also make the deadlock detection faster as no polling would be required, the deadlock would be detected instantaneously as the last thread enters the waiting state.

The solution would still allow retrieving task results without waiting on worker threads. E.g. getFinished should work.

Inner task threads also need to be checked for deadlock. Starting new tasks should also be constrained to the main task threads or main inner task threads.

@Sipkab
Copy link
Member Author

Sipkab commented Jul 5, 2020

Inner tasks will be disallowed to start new tasks as their duplication feature introduces a transient state in which deadlock is hard (or impossible?) to detect. If we'd allow inner tasks to start new tasks, then as the future duplicated inner task threads are not yet present in our representation, therefore incorrectly detecting a deadlock although new task would be started.

So to summarize, task manipulation (starting and waiting for) can only be done on the main thread of the build task. It can also be done on build clusters so that is allowed now. Inner tasks are not allowed to any of these. However, they can start new inner tasks and wait for their results.

The retrieval of inner task results are limited to task threads only, however, this may be lifted in the future. (As well with other inner task restrictions as stated above.)

Sipkab added a commit that referenced this issue Jul 5, 2020
@Sipkab
Copy link
Member Author

Sipkab commented Jul 16, 2022

Unexpected deadlock during testing:

[saker.java.test]Info: Test information: testing.saker.build.tests.tasks.script.DivideOperatorScriptTaskTest
[saker.java.test]    ----- Std out -----     
[saker.java.test] --- Running testing.saker.build.tests.tasks.script.DivideOperatorScriptTaskTest with EnvironmentTestCaseConfiguration[useProject=false, environmentStorageDirectory=common] --- 
[saker.java.test] --- Running testing.saker.build.tests.tasks.script.DivideOperatorScriptTaskTest with EnvironmentTestCaseConfiguration[useProject=true, projectFileWatchingEnabled=true, environmentStorageDirectory=common] --- 
[saker.java.test]
[saker.java.test]    ----- Std err -----     
[saker.java.test]java.lang.AssertionError: Test case failed: testing.saker.build.tests.tasks.script.DivideOperatorScriptTaskTest
[saker.java.test]Caused by: java.lang.AssertionError: saker.build.task.exception.MultiTaskExecutionFailedException: BuildTargetBootstrapperTaskIdentifier[buildFilePath=wd:/saker.build, buildTargetName=build, workingDirectory=wd:, buildDirectory=]
[saker.java.test]	at testing.saker.build.tests.EnvironmentTestCase.executeRunning(EnvironmentTestCase.java:448)
[saker.java.test]	at saker.build.thirdparty.saker.util.function.Functionals$SneakyThrowingRunnable.run(Functionals.java:145)
[saker.java.test]	at java.lang.Thread.run(Thread.java:748)
[saker.java.test]	at saker.build.thirdparty.saker.util.thread.ExceptionThread.runImpl(ExceptionThread.java:164)
[saker.java.test]	at saker.build.thirdparty.saker.util.thread.ExceptionThread.run(ExceptionThread.java:141)
[saker.java.test]Caused by: saker.build.task.exception.MultiTaskExecutionFailedException: BuildTargetBootstrapperTaskIdentifier[buildFilePath=wd:/saker.build, buildTargetName=build, workingDirectory=wd:, buildDirectory=]
[saker.java.test]	at saker.build.task.exception.ExceptionAccessInternal.createMultiTaskExecutionFailedException(ExceptionAccessInternal.java:38)
[saker.java.test]	at saker.build.task.TaskExecutionManager.execute(TaskExecutionManager.java:4229)
[saker.java.test]	at saker.build.runtime.execution.ExecutionContextImpl.executeTask(ExecutionContextImpl.java:491)
[saker.java.test]	at saker.build.runtime.environment.SakerEnvironmentImpl$TaskRunnerThread.runWithContext(SakerEnvironmentImpl.java:919)
[saker.java.test]	at saker.build.runtime.environment.SakerEnvironmentImpl$TaskRunnerThread.run(SakerEnvironmentImpl.java:973)
[saker.java.test]	Suppressed: saker.build.task.exception.TaskExecutionFailedException: Task execution failed. ((unsaker:(unsakertask:(assign_tid:BuildFileTargetTaskIdentifier(build@wd:/saker.build):wd:$f))))
[saker.java.test]		at saker.build.task.exception.ExceptionAccessInternal.createTaskExecutionFailedException(ExceptionAccessInternal.java:34)
[saker.java.test]		at saker.build.task.TaskExecutionManager.createFailException(TaskExecutionManager.java:6716)
[saker.java.test]		at saker.build.task.TaskExecutionManager.executeTaskRunning(TaskExecutionManager.java:6272)
[saker.java.test]		at saker.build.task.TaskExecutionManager.executeNewTaskRunning(TaskExecutionManager.java:6738)
[saker.java.test]		at saker.build.task.TaskExecutionManager.lambda$executeExecutionWithStrategy$3(TaskExecutionManager.java:4846)
[saker.java.test]		at saker.build.task.TaskExecutionManager$TaskExecutionThread.run(TaskExecutionManager.java:4514)
[saker.java.test]	Caused by: saker.build.task.exception.TaskExecutionDeadlockedException: BuildFileTargetTaskIdentifier(build@wd:/saker.build):wd:/(div:((subscript:dereflit(second)[(literal:num)]) / (subscript:dereflit(second)[(literal:num)])))
[saker.java.test]		at saker.build.task.exception.ExceptionAccessInternal.createTaskExecutionDeadlockedException(ExceptionAccessInternal.java:47)
[saker.java.test]		at saker.build.task.TaskExecutionManager$ManagerTaskFutureImpl.waitCondition(TaskExecutionManager.java:3821)
[saker.java.test]		at saker.build.task.TaskExecutionManager$ManagerTaskFutureImpl.waitResultPark(TaskExecutionManager.java:3724)
[saker.java.test]		at saker.build.task.TaskExecutionManager$ManagerTaskFutureImpl.waitResultPark(TaskExecutionManager.java:3720)
[saker.java.test]		at saker.build.task.TaskExecutionManager$ManagerTaskFutureImpl.waitResultWithStateWithAncestors(TaskExecutionManager.java:3471)
[saker.java.test]		at saker.build.task.TaskExecutionManager$ManagerTaskFutureImpl.getWaitTaskResultImpl(TaskExecutionManager.java:3306)
[saker.java.test]		at saker.build.task.TaskExecutionManager$ManagerTaskFutureImpl.lambda$getWaitTaskResult$0(TaskExecutionManager.java:3297)
[saker.java.test]		at saker.build.task.TaskExecutionManager$TaskExecutorContext.runOnUnfinished(TaskExecutionManager.java:899)
[saker.java.test]		at saker.build.task.TaskExecutionManager$ManagerTaskFutureImpl.getWaitTaskResult(TaskExecutionManager.java:3296)
[saker.java.test]		at saker.build.task.TaskExecutionManager$ManagerTaskFutureImpl.get(TaskExecutionManager.java:3258)
[saker.java.test]		at saker.build.task.TaskExecutionManager$UserTaskFuture.internalGetOnTaskThread(TaskExecutionManager.java:2681)
[saker.java.test]		at saker.build.task.TaskExecutionManager$UserTaskFuture.get(TaskExecutionManager.java:2676)
[saker.java.test]		at saker.build.task.TaskContext.getTaskResult(TaskContext.java:601)
[saker.java.test]		at saker.build.internal.scripting.language.task.result.SakerTaskObjectSakerTaskResult.getSakerResult(SakerTaskObjectSakerTaskResult.java:80)
[saker.java.test]		at saker.build.internal.scripting.language.task.result.SakerTaskObjectSakerTaskResult.get(SakerTaskObjectSakerTaskResult.java:54)
[saker.java.test]		at saker.build.internal.scripting.language.task.UnsakerFutureTaskFactory.run(UnsakerFutureTaskFactory.java:49)
[saker.java.test]		at saker.build.task.TaskInvocationManager.invokeTaskRunningOnLocalEnvironment(TaskInvocationManager.java:313)
[saker.java.test]		at saker.build.task.TaskInvocationManager.invokeTaskRunning(TaskInvocationManager.java:283)
[saker.java.test]		at saker.build.task.TaskExecutionManager.executeTaskRunning(TaskExecutionManager.java:6227)
[saker.java.test]		... 3 more
[saker.java.test]	Suppressed: saker.build.task.exception.TaskExecutionFailedException: Task execution failed. ((unsaker:(unsakertask:(assign_tid:BuildFileTargetTaskIdentifier(build@wd:/saker.build):wd:$e))))
[saker.java.test]		at saker.build.task.exception.ExceptionAccessInternal.createTaskExecutionFailedException(ExceptionAccessInternal.java:34)
[saker.java.test]		at saker.build.task.TaskExecutionManager.createFailException(TaskExecutionManager.java:6716)
[saker.java.test]		at saker.build.task.TaskExecutionManager.executeTaskRunning(TaskExecutionManager.java:6272)
[saker.java.test]		at saker.build.task.TaskExecutionManager.executeNewTaskRunning(TaskExecutionManager.java:6738)
[saker.java.test]		at saker.build.task.TaskExecutionManager.lambda$executeExecutionWithStrategy$3(TaskExecutionManager.java:4846)
[saker.java.test]		at saker.build.task.TaskExecutionManager$TaskExecutionThread.run(TaskExecutionManager.java:4514)
[saker.java.test]	Caused by: saker.build.task.exception.TaskExecutionDeadlockedException: BuildFileTargetTaskIdentifier(build@wd:/saker.build):wd:/(div:((literal:100) / (subscript:dereflit(second)[(literal:num)])))
[saker.java.test]		at saker.build.task.exception.ExceptionAccessInternal.createTaskExecutionDeadlockedException(ExceptionAccessInternal.java:47)
[saker.java.test]		at saker.build.task.TaskExecutionManager$ManagerTaskFutureImpl.waitCondition(TaskExecutionManager.java:3821)
[saker.java.test]		at saker.build.task.TaskExecutionManager$ManagerTaskFutureImpl.waitResultPark(TaskExecutionManager.java:3724)
[saker.java.test]		at saker.build.task.TaskExecutionManager$ManagerTaskFutureImpl.waitResultPark(TaskExecutionManager.java:3720)
[saker.java.test]		at saker.build.task.TaskExecutionManager$ManagerTaskFutureImpl.waitResultWithStateWithAncestors(TaskExecutionManager.java:3467)
[saker.java.test]		at saker.build.task.TaskExecutionManager$ManagerTaskFutureImpl.getWaitTaskResultImpl(TaskExecutionManager.java:3306)
[saker.java.test]		at saker.build.task.TaskExecutionManager$ManagerTaskFutureImpl.lambda$getWaitTaskResult$0(TaskExecutionManager.java:3297)
[saker.java.test]		at saker.build.task.TaskExecutionManager$TaskExecutorContext.runOnUnfinished(TaskExecutionManager.java:899)
[saker.java.test]		at saker.build.task.TaskExecutionManager$ManagerTaskFutureImpl.getWaitTaskResult(TaskExecutionManager.java:3296)
[saker.java.test]		at saker.build.task.TaskExecutionManager$ManagerTaskFutureImpl.get(TaskExecutionManager.java:3258)
[saker.java.test]		at saker.build.task.TaskExecutionManager$UserTaskFuture.internalGetOnTaskThread(TaskExecutionManager.java:2681)
[saker.java.test]		at saker.build.task.TaskExecutionManager$UserTaskFuture.get(TaskExecutionManager.java:2676)
[saker.java.test]		at saker.build.task.TaskContext.getTaskResult(TaskContext.java:601)
[saker.java.test]		at saker.build.internal.scripting.language.task.result.SakerTaskObjectSakerTaskResult.getSakerResult(SakerTaskObjectSakerTaskResult.java:80)
[saker.java.test]		at saker.build.internal.scripting.language.task.result.SakerTaskObjectSakerTaskResult.get(SakerTaskObjectSakerTaskResult.java:54)
[saker.java.test]		at saker.build.internal.scripting.language.task.UnsakerFutureTaskFactory.run(UnsakerFutureTaskFactory.java:49)
[saker.java.test]		at saker.build.task.TaskInvocationManager.invokeTaskRunningOnLocalEnvironment(TaskInvocationManager.java:313)
[saker.java.test]		at saker.build.task.TaskInvocationManager.invokeTaskRunning(TaskInvocationManager.java:283)
[saker.java.test]		at saker.build.task.TaskExecutionManager.executeTaskRunning(TaskExecutionManager.java:6227)
[saker.java.test]		... 3 more
[saker.java.test]	Suppressed: saker.build.task.exception.TaskExecutionFailedException: Task execution failed. (BuildFileTargetTaskIdentifier(build@wd:/saker.build):wd:/(div:((subscript:dereflit(second)[(literal:num)]) / (subscript:dereflit(second)[(literal:num)]))))
[saker.java.test]		at saker.build.task.exception.ExceptionAccessInternal.createTaskExecutionFailedException(ExceptionAccessInternal.java:34)
[saker.java.test]		at saker.build.task.TaskExecutionManager.createFailException(TaskExecutionManager.java:6716)
[saker.java.test]		at saker.build.task.TaskExecutionManager.executeTaskRunning(TaskExecutionManager.java:6272)
[saker.java.test]		at saker.build.task.TaskExecutionManager.executeNewTaskRunning(TaskExecutionManager.java:6738)
[saker.java.test]		at saker.build.task.TaskExecutionManager.lambda$executeExecutionWithStrategy$3(TaskExecutionManager.java:4846)
[saker.java.test]		at saker.build.task.TaskExecutionManager$TaskExecutionThread.run(TaskExecutionManager.java:4514)
[saker.java.test]	Caused by: saker.build.task.exception.TaskExecutionDeadlockedException: (unsaker:(unsakertask:(assign_tid:BuildFileTargetTaskIdentifier(build@wd:/second.build):wd:$num)))
[saker.java.test]		at saker.build.task.exception.ExceptionAccessInternal.createTaskExecutionDeadlockedException(ExceptionAccessInternal.java:47)
[saker.java.test]		at saker.build.task.TaskExecutionManager$ManagerTaskFutureImpl.waitCondition(TaskExecutionManager.java:3821)
[saker.java.test]		at saker.build.task.TaskExecutionManager$ManagerTaskFutureImpl.waitResultPark(TaskExecutionManager.java:3724)
[saker.java.test]		at saker.build.task.TaskExecutionManager$ManagerTaskFutureImpl.waitResultPark(TaskExecutionManager.java:3720)
[saker.java.test]		at saker.build.task.TaskExecutionManager$ManagerTaskFutureImpl.waitResultWithStateWithAncestors(TaskExecutionManager.java:3471)
[saker.java.test]		at saker.build.task.TaskExecutionManager$ManagerTaskFutureImpl.getWaitTaskResultImpl(TaskExecutionManager.java:3306)
[saker.java.test]		at saker.build.task.TaskExecutionManager$ManagerTaskFutureImpl.lambda$getWaitTaskResult$0(TaskExecutionManager.java:3297)
[saker.java.test]		at saker.build.task.TaskExecutionManager$TaskExecutorContext.runOnUnfinished(TaskExecutionManager.java:899)
[saker.java.test]		at saker.build.task.TaskExecutionManager$ManagerTaskFutureImpl.getWaitTaskResult(TaskExecutionManager.java:3296)
[saker.java.test]		at saker.build.task.TaskExecutionManager$ManagerTaskFutureImpl.get(TaskExecutionManager.java:3258)
[saker.java.test]		at saker.build.task.TaskExecutionManager$UserTaskFuture.internalGetOnTaskThread(TaskExecutionManager.java:2681)
[saker.java.test]		at saker.build.task.TaskExecutionManager$UserTaskFuture.get(TaskExecutionManager.java:2676)
[saker.java.test]		at saker.build.task.TaskContext.getTaskResult(TaskContext.java:601)
[saker.java.test]		at saker.build.internal.scripting.language.task.result.SubscriptSakerTaskResult.calculateResult(SubscriptSakerTaskResult.java:203)
[saker.java.test]		at saker.build.internal.scripting.language.task.result.SubscriptSakerTaskResult.get(SubscriptSakerTaskResult.java:96)
[saker.java.test]		at saker.build.internal.scripting.language.task.operators.BinaryNumberOperatorTaskFactory.evaluateOperand(BinaryNumberOperatorTaskFactory.java:68)
[saker.java.test]		at saker.build.internal.scripting.language.task.operators.BinaryNumberOperatorTaskFactory.run(BinaryNumberOperatorTaskFactory.java:57)
[saker.java.test]		at saker.build.internal.scripting.language.task.operators.BinaryNumberOperatorTaskFactory.run(BinaryNumberOperatorTaskFactory.java:34)
[saker.java.test]		at saker.build.task.TaskInvocationManager.invokeTaskRunningOnLocalEnvironment(TaskInvocationManager.java:313)
[saker.java.test]		at saker.build.task.TaskInvocationManager.invokeTaskRunning(TaskInvocationManager.java:283)
[saker.java.test]		at saker.build.task.TaskExecutionManager.executeTaskRunning(TaskExecutionManager.java:6227)
[saker.java.test]		... 3 more
[saker.java.test]	Suppressed: saker.build.task.exception.TaskExecutionFailedException: Task execution failed. (BuildFileTargetTaskIdentifier(build@wd:/saker.build):wd:/(div:((literal:100) / (subscript:dereflit(second)[(literal:num)]))))
[saker.java.test]		at saker.build.task.exception.ExceptionAccessInternal.createTaskExecutionFailedException(ExceptionAccessInternal.java:34)
[saker.java.test]		at saker.build.task.TaskExecutionManager.createFailException(TaskExecutionManager.java:6716)
[saker.java.test]		at saker.build.task.TaskExecutionManager.executeTaskRunning(TaskExecutionManager.java:6272)
[saker.java.test]		at saker.build.task.TaskExecutionManager.executeNewTaskRunning(TaskExecutionManager.java:6738)
[saker.java.test]		at saker.build.task.TaskExecutionManager.lambda$executeExecutionWithStrategy$3(TaskExecutionManager.java:4846)
[saker.java.test]		at saker.build.task.TaskExecutionManager$TaskExecutionThread.run(TaskExecutionManager.java:4514)
[saker.java.test]	Caused by: saker.build.task.exception.TaskExecutionDeadlockedException: (unsaker:(unsakertask:(assign_tid:BuildFileTargetTaskIdentifier(build@wd:/second.build):wd:$num)))
[saker.java.test]		at saker.build.task.exception.ExceptionAccessInternal.createTaskExecutionDeadlockedException(ExceptionAccessInternal.java:47)
[saker.java.test]		at saker.build.task.TaskExecutionManager$ManagerTaskFutureImpl.waitCondition(TaskExecutionManager.java:3834)
[saker.java.test]		at saker.build.task.TaskExecutionManager$ManagerTaskFutureImpl.waitResultPark(TaskExecutionManager.java:3724)
[saker.java.test]		at saker.build.task.TaskExecutionManager$ManagerTaskFutureImpl.waitResultPark(TaskExecutionManager.java:3720)
[saker.java.test]		at saker.build.task.TaskExecutionManager$ManagerTaskFutureImpl.waitResultWithStateWithAncestors(TaskExecutionManager.java:3471)
[saker.java.test]		at saker.build.task.TaskExecutionManager$ManagerTaskFutureImpl.getWaitTaskResultImpl(TaskExecutionManager.java:3306)
[saker.java.test]		at saker.build.task.TaskExecutionManager$ManagerTaskFutureImpl.lambda$getWaitTaskResult$0(TaskExecutionManager.java:3297)
[saker.java.test]		at saker.build.task.TaskExecutionManager$TaskExecutorContext.runOnUnfinished(TaskExecutionManager.java:899)
[saker.java.test]		at saker.build.task.TaskExecutionManager$ManagerTaskFutureImpl.getWaitTaskResult(TaskExecutionManager.java:3296)
[saker.java.test]		at saker.build.task.TaskExecutionManager$ManagerTaskFutureImpl.get(TaskExecutionManager.java:3258)
[saker.java.test]		at saker.build.task.TaskExecutionManager$UserTaskFuture.internalGetOnTaskThread(TaskExecutionManager.java:2681)
[saker.java.test]		at saker.build.task.TaskExecutionManager$UserTaskFuture.get(TaskExecutionManager.java:2676)
[saker.java.test]		at saker.build.task.TaskContext.getTaskResult(TaskContext.java:601)
[saker.java.test]		at saker.build.internal.scripting.language.task.result.SubscriptSakerTaskResult.calculateResult(SubscriptSakerTaskResult.java:203)
[saker.java.test]		at saker.build.internal.scripting.language.task.result.SubscriptSakerTaskResult.get(SubscriptSakerTaskResult.java:96)
[saker.java.test]		at saker.build.internal.scripting.language.task.operators.BinaryNumberOperatorTaskFactory.evaluateOperand(BinaryNumberOperatorTaskFactory.java:68)
[saker.java.test]		at saker.build.internal.scripting.language.task.operators.BinaryNumberOperatorTaskFactory.run(BinaryNumberOperatorTaskFactory.java:58)
[saker.java.test]		at saker.build.internal.scripting.language.task.operators.BinaryNumberOperatorTaskFactory.run(BinaryNumberOperatorTaskFactory.java:34)
[saker.java.test]		at saker.build.task.TaskInvocationManager.invokeTaskRunningOnLocalEnvironment(TaskInvocationManager.java:313)
[saker.java.test]		at saker.build.task.TaskInvocationManager.invokeTaskRunning(TaskInvocationManager.java:283)
[saker.java.test]		at saker.build.task.TaskExecutionManager.executeTaskRunning(TaskExecutionManager.java:6227)
[saker.java.test]		... 3 more
[saker.java.test]	Suppressed: java.lang.RuntimeException: Caller stacktrace.
[saker.java.test]		at testing.saker.build.tests.EnvironmentTestCase.getTaskResultCollectionThrow(EnvironmentTestCase.java:509)
[saker.java.test]		at testing.saker.build.tests.EnvironmentTestCase.runScriptTask(EnvironmentTestCase.java:589)
[saker.java.test]		at testing.saker.build.tests.EnvironmentTestCase.runScriptTask(EnvironmentTestCase.java:578)
[saker.java.test]		at testing.saker.build.tests.tasks.script.DivideOperatorScriptTaskTest.runTestImpl(DivideOperatorScriptTaskTest.java:28)
[saker.java.test]		at testing.saker.build.tests.EnvironmentTestCase.executeRunning(EnvironmentTestCase.java:431)
[saker.java.test]		at saker.build.thirdparty.saker.util.function.Functionals$SneakyThrowingRunnable.run(Functionals.java:145)
[saker.java.test]		at java.lang.Thread.run(Thread.java:748)
[saker.java.test]		at saker.build.thirdparty.saker.util.thread.ExceptionThread.runImpl(ExceptionThread.java:164)
[saker.java.test]		at saker.build.thirdparty.saker.util.thread.ExceptionThread.run(ExceptionThread.java:141)
[saker.java.test]
[saker.java.test]
[saker.java.test]Error: Test failed: testing.saker.build.tests.tasks.script.DivideOperatorScriptTaskTest (0.112 seconds)

Sipkab added a commit that referenced this issue Jul 17, 2022
Make it clearer what the code does when waiting for task ancestors

Related issue #22
@Sipkab
Copy link
Member Author

Sipkab commented Jul 17, 2022

Another related error in CI build, logs below.

Seems like the issue is that sometimes a waiting thread doesn't get unparked when the condition gets satisfied. At least in the below case, the stack trace shows that the thread was waiting for the ancestors (the task with "plus" identifier) to be finished. After the timeout interruption, the condition check returned successful, and the task was further executed.

[saker.java.test]Info: Test information: testing.saker.build.tests.tasks.AddAncestorBlockingWaitTaskTest
[saker.java.test]    ----- Std out -----     
[saker.java.test] --- Running testing.saker.build.tests.tasks.AddAncestorBlockingWaitTaskTest with EnvironmentTestCaseConfiguration[useProject=false, environmentStorageDirectory=common] --- 
[saker.java.test]Reached: waiter_start
[saker.java.test]Reached: blocker_start
[saker.java.test]Reached: blocker_started
[saker.java.test]Reached: plus_starter
[saker.java.test]Reached: plus_started
[saker.java.test]Reached: waiter_end
[saker.java.test]
[saker.java.test]    ----- Std err -----     
[saker.java.test]Info: timeout on testing.saker.build.tests.tasks.AddAncestorBlockingWaitTaskTest
[saker.java.test]Thread: Thread[ClassPathLoadManager-cleaner,5,Environment group]
[saker.java.test]    [email protected]/java.lang.Object.wait(Native Method)
[saker.java.test]    [email protected]/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:151)
[saker.java.test]    [email protected]/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:172)
[saker.java.test]    saker.build.runtime.classpath.ClassPathLoadManager$CleanerRunnable.run(ClassPathLoadManager.java:327)
[saker.java.test]    [email protected]/java.lang.Thread.run(Thread.java:844)
[saker.java.test]Thread: Thread[RMI-worker-2,5,RMI worker group]
[saker.java.test]    [email protected]/java.net.SocketInputStream.socketRead0(Native Method)
[saker.java.test]    [email protected]/java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
[saker.java.test]    [email protected]/java.net.SocketInputStream.read(SocketInputStream.java:171)
[saker.java.test]    [email protected]/java.net.SocketInputStream.read(SocketInputStream.java:141)
[saker.java.test]    app//saker.build.thirdparty.saker.util.io.UnsyncBufferedInputStream.read(UnsyncBufferedInputStream.java:136)
[saker.java.test]    app//saker.build.thirdparty.saker.rmi.connection.BlockInputStream.readNextBlock(BlockInputStream.java:124)
[saker.java.test]    app//saker.build.thirdparty.saker.rmi.connection.BlockInputStream.goToCurrentBlock(BlockInputStream.java:76)
[saker.java.test]    app//saker.build.thirdparty.saker.rmi.connection.BlockInputStream.read(BlockInputStream.java:104)
[saker.java.test]    app//saker.build.thirdparty.saker.util.io.StreamUtils.readFromStream(StreamUtils.java:1698)
[saker.java.test]    app//saker.build.thirdparty.saker.util.io.InputStreamByteSource.read(InputStreamByteSource.java:97)
[saker.java.test]    app//saker.build.thirdparty.saker.util.io.UnsyncByteArrayOutputStream.readFrom(UnsyncByteArrayOutputStream.java:158)
[saker.java.test]    app//saker.build.thirdparty.saker.util.io.UnsyncByteArrayOutputStream.readFrom(UnsyncByteArrayOutputStream.java:213)
[saker.java.test]    app//saker.build.thirdparty.saker.rmi.connection.RMIStream.runInput(RMIStream.java:2179)
[saker.java.test]    app//saker.build.thirdparty.saker.rmi.connection.RMIStream$$Lambda$199/1168268050.run(Unknown Source)
[saker.java.test]    app//saker.build.thirdparty.saker.rmi.connection.RMIConnection.lambda$offerStreamTask$2(RMIConnection.java:718)
[saker.java.test]    app//saker.build.thirdparty.saker.rmi.connection.RMIConnection$$Lambda$197/3103109.run(Unknown Source)
[saker.java.test]    app//saker.build.thirdparty.saker.util.thread.ThreadUtils$DynamicWorkPool.lambda$offer$0(ThreadUtils.java:2366)
[saker.java.test]    app//saker.build.thirdparty.saker.util.thread.ThreadUtils$DynamicWorkPool$$Lambda$104/1402433372.accept(Unknown Source)
[saker.java.test]    app//saker.build.thirdparty.saker.util.thread.ThreadUtils.callWorker(ThreadUtils.java:1522)
[saker.java.test]    app//saker.build.thirdparty.saker.util.thread.ThreadUtils.access$1600(ThreadUtils.java:54)
[saker.java.test]    app//saker.build.thirdparty.saker.util.thread.ThreadUtils$WorkerThread.run(ThreadUtils.java:2913)
[saker.java.test]Thread: Thread[RMI-worker-6,5,RMI worker group]
[saker.java.test]    [email protected]/java.lang.Object.wait(Native Method)
[saker.java.test]    [email protected]/java.lang.Thread.join(Thread.java:1353)
[saker.java.test]    [email protected]/java.lang.Thread.join(Thread.java:1427)
[saker.java.test]    testing.saker.SakerJavaTestingInvoker.invokeTest(SakerJavaTestingInvoker.java:121)
[saker.java.test]    testing.saker.SakerJavaTestingInvoker.runTest(SakerJavaTestingInvoker.java:75)
[saker.java.test]    saker.java.testing.api.test.invoker.BasicInstrumentationJavaTestInvoker.runTestImpl(BasicInstrumentationJavaTestInvoker.java:95)
[saker.java.test]    saker.java.testing.api.test.invoker.BasicInstrumentationJavaTestInvoker.invokeTestImpl(BasicInstrumentationJavaTestInvoker.java:66)
[saker.java.test]    saker.java.testing.api.test.invoker.BasicJavaTestingInvoker.invokeTest(BasicJavaTestingInvoker.java:175)
[saker.java.test]    jdk.internal.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
[saker.java.test]    [email protected]/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[saker.java.test]    [email protected]/java.lang.reflect.Method.invoke(Method.java:564)
[saker.java.test]    app//saker.build.thirdparty.saker.util.ReflectUtils.invokeMethod(ReflectUtils.java:430)
[saker.java.test]    app//saker.build.thirdparty.saker.rmi.connection.RMIStream.invokeMethodWithRequestId(RMIStream.java:2914)
[saker.java.test]    app//saker.build.thirdparty.saker.rmi.connection.RMIStream.invokeAndWriteMethodCall(RMIStream.java:2404)
[saker.java.test]    app//saker.build.thirdparty.saker.rmi.connection.RMIStream.handleCommandMethodCall(RMIStream.java:2082)
[saker.java.test]    app//saker.build.thirdparty.saker.rmi.connection.RMIStream$$Lambda$141/1855227125.accept(Unknown Source)
[saker.java.test]    app//saker.build.thirdparty.saker.rmi.connection.RMIStream.handleCommand(RMIStream.java:2165)
[saker.java.test]    app//saker.build.thirdparty.saker.rmi.connection.RMIStream.runInput(RMIStream.java:2208)
[saker.java.test]    app//saker.build.thirdparty.saker.rmi.connection.RMIStream$$Lambda$199/1168268050.run(Unknown Source)
[saker.java.test]    app//saker.build.thirdparty.saker.rmi.connection.RMIConnection.lambda$offerStreamTask$2(RMIConnection.java:718)
[saker.java.test]    app//saker.build.thirdparty.saker.rmi.connection.RMIConnection$$Lambda$197/3103109.run(Unknown Source)
[saker.java.test]    app//saker.build.thirdparty.saker.util.thread.ThreadUtils$DynamicWorkPool.lambda$offer$0(ThreadUtils.java:2366)
[saker.java.test]    app//saker.build.thirdparty.saker.util.thread.ThreadUtils$DynamicWorkPool$$Lambda$104/1402433372.accept(Unknown Source)
[saker.java.test]    app//saker.build.thirdparty.saker.util.thread.ThreadUtils.callWorker(ThreadUtils.java:1522)
[saker.java.test]    app//saker.build.thirdparty.saker.util.thread.ThreadUtils.access$1600(ThreadUtils.java:54)
[saker.java.test]    app//saker.build.thirdparty.saker.util.thread.ThreadUtils$WorkerThread.run(ThreadUtils.java:2913)
[saker.java.test]Thread: Thread[Stdout printer,5,main]
[saker.java.test]    [email protected]/jdk.internal.misc.Unsafe.park(Native Method)
[saker.java.test]    [email protected]/java.util.concurrent.locks.LockSupport.park(LockSupport.java:194)
[saker.java.test]    [email protected]/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2075)
[saker.java.test]    app//saker.build.thirdparty.saker.util.io.ReadWriteBufferOutputStream.readLocked(ReadWriteBufferOutputStream.java:170)
[saker.java.test]    app//saker.build.thirdparty.saker.util.io.ReadWriteBufferOutputStream.read(ReadWriteBufferOutputStream.java:144)
[saker.java.test]    app//saker.build.thirdparty.saker.util.io.ReadWriteBufferOutputStream.read(ReadWriteBufferOutputStream.java:426)
[saker.java.test]    app//saker.build.thirdparty.saker.util.io.ByteSourceInputStream.read(ByteSourceInputStream.java:52)
[saker.java.test]    app//saker.build.thirdparty.saker.util.io.StreamUtils.copyStream(StreamUtils.java:745)
[saker.java.test]    app//saker.build.thirdparty.saker.util.io.StreamUtils.copyStream(StreamUtils.java:721)
[saker.java.test]    app//saker.build.thirdparty.saker.util.io.StreamUtils.copyStream(StreamUtils.java:699)
[saker.java.test]    saker.java.testing.impl.test.launching.SakerRMIDaemon.lambda$runServer$0(SakerRMIDaemon.java:99)
[saker.java.test]    saker.java.testing.impl.test.launching.SakerRMIDaemon$$Lambda$98/1346201722.run(Unknown Source)
[saker.java.test]    [email protected]/java.lang.Thread.run(Thread.java:844)
[saker.java.test]Thread: Thread[RMI-worker-4,5,RMI worker group]
[saker.java.test]    [email protected]/java.lang.Object.wait(Native Method)
[saker.java.test]    [email protected]/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:151)
[saker.java.test]    [email protected]/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:172)
[saker.java.test]    app//saker.build.thirdparty.saker.rmi.connection.RMIVariables.runGcThread(RMIVariables.java:1331)
[saker.java.test]    app//saker.build.thirdparty.saker.rmi.connection.RMIVariables.lambda$new$0(RMIVariables.java:155)
[saker.java.test]    app//saker.build.thirdparty.saker.rmi.connection.RMIVariables$$Lambda$200/1928855807.run(Unknown Source)
[saker.java.test]    app//saker.build.thirdparty.saker.util.thread.ThreadUtils$DynamicWorkPool.lambda$offer$0(ThreadUtils.java:2366)
[saker.java.test]    app//saker.build.thirdparty.saker.util.thread.ThreadUtils$DynamicWorkPool$$Lambda$104/1402433372.accept(Unknown Source)
[saker.java.test]    app//saker.build.thirdparty.saker.util.thread.ThreadUtils.callWorker(ThreadUtils.java:1522)
[saker.java.test]    app//saker.build.thirdparty.saker.util.thread.ThreadUtils.access$1600(ThreadUtils.java:54)
[saker.java.test]    app//saker.build.thirdparty.saker.util.thread.ThreadUtils$WorkerThread.run(ThreadUtils.java:2897)
[saker.java.test]Thread: Thread[Cache GC,5,Environment group]
[saker.java.test]    [email protected]/java.lang.Object.wait(Native Method)
[saker.java.test]    [email protected]/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:151)
[saker.java.test]    saker.build.util.cache.SakerDataCache$CacheGCThread.run(SakerDataCache.java:155)
[saker.java.test]Thread: Thread[Execution context-49,5,Saker build execution]
[saker.java.test]    [email protected]/java.lang.Object.wait(Native Method)
[saker.java.test]    [email protected]/java.lang.Thread.join(Thread.java:1353)
[saker.java.test]    [email protected]/java.lang.Thread.join(Thread.java:1427)
[saker.java.test]    saker.build.task.TaskExecutionManager.execute(TaskExecutionManager.java:4252)
[saker.java.test]    saker.build.runtime.execution.ExecutionContextImpl.executeTask(ExecutionContextImpl.java:491)
[saker.java.test]    saker.build.runtime.environment.SakerEnvironmentImpl$TaskRunnerThread.runWithContext(SakerEnvironmentImpl.java:919)
[saker.java.test]    saker.build.runtime.environment.SakerEnvironmentImpl$TaskRunnerThread.run(SakerEnvironmentImpl.java:973)
[saker.java.test]Thread: Thread[Task: testing.saker.build.tests.tasks.AddAncestorBlockingWaitTaskTest$BlockerStarterTaskFactory,5,Task execution: StringTaskIdentifier[main]]
[saker.java.test]    [email protected]/java.lang.Object.wait(Native Method)
[saker.java.test]    [email protected]/java.lang.Object.wait(Object.java:328)
[saker.java.test]    testing.saker.build.tests.ExecutionOrderer.enter(ExecutionOrderer.java:56)
[saker.java.test]    testing.saker.build.tests.tasks.AddAncestorBlockingWaitTaskTest$BlockerStarterTaskFactory.run(AddAncestorBlockingWaitTaskTest.java:79)
[saker.java.test]    testing.saker.build.tests.tasks.AddAncestorBlockingWaitTaskTest$BlockerStarterTaskFactory.run(AddAncestorBlockingWaitTaskTest.java:69)
[saker.java.test]    saker.build.task.TaskInvocationManager.invokeTaskRunningOnLocalEnvironment(TaskInvocationManager.java:313)
[saker.java.test]    saker.build.task.TaskInvocationManager.invokeTaskRunning(TaskInvocationManager.java:283)
[saker.java.test]    saker.build.task.TaskExecutionManager.executeTaskRunning(TaskExecutionManager.java:6288)
[saker.java.test]    saker.build.task.TaskExecutionManager.executeNewTaskRunning(TaskExecutionManager.java:6799)
[saker.java.test]    saker.build.task.TaskExecutionManager.lambda$executeExecutionWithStrategy$3(TaskExecutionManager.java:4907)
[saker.java.test]    saker.build.task.TaskExecutionManager$$Lambda$364/1133998860.run(Unknown Source)
[saker.java.test]    saker.build.task.TaskExecutionManager$$Lambda$516/929931272.run(Unknown Source)
[saker.java.test]    saker.build.task.TaskExecutionManager$TaskExecutionThread.run(TaskExecutionManager.java:4575)
[saker.java.test]Thread: Thread[Task: testing.saker.build.tests.tasks.AddAncestorBlockingWaitTaskTest$WaiterTaskFactory,5,Task execution: StringTaskIdentifier[main]]
[saker.java.test]    [email protected]/jdk.internal.misc.Unsafe.park(Native Method)
[saker.java.test]    [email protected]/java.util.concurrent.locks.LockSupport.park(LockSupport.java:323)
[saker.java.test]    saker.build.task.TaskExecutionManager$ManagerTaskFutureImpl.waitCondition(TaskExecutionManager.java:3908)
[saker.java.test]    saker.build.task.TaskExecutionManager$ManagerTaskFutureImpl.getTaskResultForContextWaitAncestors(TaskExecutionManager.java:3587)
[saker.java.test]    saker.build.task.TaskExecutionManager$ManagerTaskFutureImpl.waitResultWithStateWithAncestors(TaskExecutionManager.java:3476)
[saker.java.test]    saker.build.task.TaskExecutionManager$ManagerTaskFutureImpl.getWaitTaskResultImpl(TaskExecutionManager.java:3306)
[saker.java.test]    saker.build.task.TaskExecutionManager$ManagerTaskFutureImpl.lambda$getWaitTaskResult$0(TaskExecutionManager.java:3297)
[saker.java.test]    saker.build.task.TaskExecutionManager$ManagerTaskFutureImpl$$Lambda$520/526515050.get(Unknown Source)
[saker.java.test]    saker.build.task.TaskExecutionManager$TaskExecutorContext.runOnUnfinished(TaskExecutionManager.java:899)
[saker.java.test]    saker.build.task.TaskExecutionManager$ManagerTaskFutureImpl.getWaitTaskResult(TaskExecutionManager.java:3296)
[saker.java.test]    saker.build.task.TaskExecutionManager$ManagerTaskFutureImpl.get(TaskExecutionManager.java:3258)
[saker.java.test]    saker.build.task.TaskExecutionManager$UserTaskFuture.internalGetOnTaskThread(TaskExecutionManager.java:2681)
[saker.java.test]    saker.build.task.TaskExecutionManager$UserTaskFuture.get(TaskExecutionManager.java:2676)
[saker.java.test]    saker.build.task.TaskContext.getTaskResult(TaskContext.java:601)
[saker.java.test]    testing.saker.build.tests.tasks.AddAncestorBlockingWaitTaskTest$WaiterTaskFactory.run(AddAncestorBlockingWaitTaskTest.java:61)
[saker.java.test]    testing.saker.build.tests.tasks.AddAncestorBlockingWaitTaskTest$WaiterTaskFactory.run(AddAncestorBlockingWaitTaskTest.java:55)
[saker.java.test]    saker.build.task.TaskInvocationManager.invokeTaskRunningOnLocalEnvironment(TaskInvocationManager.java:313)
[saker.java.test]    saker.build.task.TaskInvocationManager.invokeTaskRunning(TaskInvocationManager.java:283)
[saker.java.test]    saker.build.task.TaskExecutionManager.executeTaskRunning(TaskExecutionManager.java:6288)
[saker.java.test]    saker.build.task.TaskExecutionManager.executeNewTaskRunning(TaskExecutionManager.java:6799)
[saker.java.test]    saker.build.task.TaskExecutionManager.lambda$executeExecutionWithStrategy$3(TaskExecutionManager.java:4907)
[saker.java.test]    saker.build.task.TaskExecutionManager$$Lambda$364/1133998860.run(Unknown Source)
[saker.java.test]    saker.build.task.TaskExecutionManager$$Lambda$516/929931272.run(Unknown Source)
[saker.java.test]    saker.build.task.TaskExecutionManager$TaskExecutionThread.run(TaskExecutionManager.java:4575)
[saker.java.test]Thread: Thread[Reference Handler,10,system]
[saker.java.test]    [email protected]/java.lang.ref.Reference.waitForReferencePendingList(Native Method)
[saker.java.test]    [email protected]/java.lang.ref.Reference.processPendingReferences(Reference.java:174)
[saker.java.test]    [email protected]/java.lang.ref.Reference.access$000(Reference.java:44)
[saker.java.test]    [email protected]/java.lang.ref.Reference$ReferenceHandler.run(Unknown Source)
[saker.java.test]Thread: Thread[Test thread: testing.saker.build.tests.tasks.AddAncestorBlockingWaitTaskTest,5,Test group: testing.saker.build.tests.tasks.AddAncestorBlockingWaitTaskTest]
[saker.java.test]    [email protected]/java.lang.Object.wait(Native Method)
[saker.java.test]    [email protected]/java.lang.Thread.join(Thread.java:1353)
[saker.java.test]    [email protected]/java.lang.Thread.join(Thread.java:1427)
[saker.java.test]    saker.build.runtime.environment.SakerEnvironmentImpl.run(SakerEnvironmentImpl.java:224)
[saker.java.test]    testing.saker.build.tests.EnvironmentTestCase.runOnEnvironmentImpl(EnvironmentTestCase.java:639)
[saker.java.test]    testing.saker.build.tests.EnvironmentTestCase.lambda$runTask$1(EnvironmentTestCase.java:529)
[saker.java.test]    testing.saker.build.tests.EnvironmentTestCase$$Lambda$353/1485036172.get(Unknown Source)
[saker.java.test]    testing.saker.build.tests.EnvironmentTestCase.runTask(EnvironmentTestCase.java:521)
[saker.java.test]    testing.saker.build.tests.EnvironmentTestCase.runTask(EnvironmentTestCase.java:529)
[saker.java.test]    testing.saker.build.tests.EnvironmentTestCase.runTask(EnvironmentTestCase.java:533)
[saker.java.test]    testing.saker.build.tests.tasks.AddAncestorBlockingWaitTaskTest.runTestImpl(AddAncestorBlockingWaitTaskTest.java:100)
[saker.java.test]    testing.saker.build.tests.EnvironmentTestCase.executeRunning(EnvironmentTestCase.java:431)
[saker.java.test]    testing.saker.build.tests.EnvironmentTestCase$$Lambda$253/1486089235.run(Unknown Source)
[saker.java.test]    saker.build.thirdparty.saker.util.function.Functionals$SneakyThrowingRunnable.run(Functionals.java:145)
[saker.java.test]    [email protected]/java.lang.Thread.run(Thread.java:844)
[saker.java.test]    saker.build.thirdparty.saker.util.thread.ExceptionThread.runImpl(ExceptionThread.java:164)
[saker.java.test]    saker.build.thirdparty.saker.util.thread.ExceptionThread.run(ExceptionThread.java:141)
[saker.java.test]Thread: Thread[RMI-worker-5,5,RMI worker group]
[saker.java.test]    [email protected]/java.net.SocketInputStream.socketRead0(Native Method)
[saker.java.test]    [email protected]/java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
[saker.java.test]    [email protected]/java.net.SocketInputStream.read(SocketInputStream.java:171)
[saker.java.test]    [email protected]/java.net.SocketInputStream.read(SocketInputStream.java:141)
[saker.java.test]    app//saker.build.thirdparty.saker.util.io.UnsyncBufferedInputStream.read(UnsyncBufferedInputStream.java:136)
[saker.java.test]    app//saker.build.thirdparty.saker.rmi.connection.BlockInputStream.readNextBlock(BlockInputStream.java:124)
[saker.java.test]    app//saker.build.thirdparty.saker.rmi.connection.BlockInputStream.goToCurrentBlock(BlockInputStream.java:76)
[saker.java.test]    app//saker.build.thirdparty.saker.rmi.connection.BlockInputStream.read(BlockInputStream.java:104)
[saker.java.test]    app//saker.build.thirdparty.saker.util.io.StreamUtils.readFromStream(StreamUtils.java:1698)
[saker.java.test]    app//saker.build.thirdparty.saker.util.io.InputStreamByteSource.read(InputStreamByteSource.java:97)
[saker.java.test]    app//saker.build.thirdparty.saker.util.io.UnsyncByteArrayOutputStream.readFrom(UnsyncByteArrayOutputStream.java:158)
[saker.java.test]    app//saker.build.thirdparty.saker.util.io.UnsyncByteArrayOutputStream.readFrom(UnsyncByteArrayOutputStream.java:213)
[saker.java.test]    app//saker.build.thirdparty.saker.rmi.connection.RMIStream.runInput(RMIStream.java:2179)
[saker.java.test]    app//saker.build.thirdparty.saker.rmi.connection.RMIStream$$Lambda$199/1168268050.run(Unknown Source)
[saker.java.test]    app//saker.build.thirdparty.saker.rmi.connection.RMIConnection.lambda$offerStreamTask$2(RMIConnection.java:718)
[saker.java.test]    app//saker.build.thirdparty.saker.rmi.connection.RMIConnection$$Lambda$197/3103109.run(Unknown Source)
[saker.java.test]    app//saker.build.thirdparty.saker.util.thread.ThreadUtils$DynamicWorkPool.lambda$offer$0(ThreadUtils.java:2366)
[saker.java.test]    app//saker.build.thirdparty.saker.util.thread.ThreadUtils$DynamicWorkPool$$Lambda$104/1402433372.accept(Unknown Source)
[saker.java.test]    app//saker.build.thirdparty.saker.util.thread.ThreadUtils.callWorker(ThreadUtils.java:1522)
[saker.java.test]    app//saker.build.thirdparty.saker.util.thread.ThreadUtils.access$1600(ThreadUtils.java:54)
[saker.java.test]    app//saker.build.thirdparty.saker.util.thread.ThreadUtils$WorkerThread.run(ThreadUtils.java:2913)
[saker.java.test]Thread: Thread[main,5,main]
[saker.java.test]    [email protected]/java.net.PlainSocketImpl.socketAccept(Native Method)
[saker.java.test]    [email protected]/java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:459)
[saker.java.test]    [email protected]/java.net.ServerSocket.implAccept(ServerSocket.java:551)
[saker.java.test]    [email protected]/java.net.ServerSocket.accept(ServerSocket.java:519)
[saker.java.test]    app//saker.build.thirdparty.saker.rmi.connection.RMIServer.acceptConnectionsImpl(RMIServer.java:843)
[saker.java.test]    app//saker.build.thirdparty.saker.rmi.connection.RMIServer.acceptConnections(RMIServer.java:226)
[saker.java.test]    app//saker.build.thirdparty.saker.rmi.connection.RMIServer.acceptConnections(RMIServer.java:208)
[saker.java.test]    saker.java.testing.impl.test.launching.SakerRMIDaemon.runServer(SakerRMIDaemon.java:111)
[saker.java.test]    saker.java.testing.impl.test.launching.SakerRMIDaemon.run(SakerRMIDaemon.java:58)
[saker.java.test]    saker.java.testing.impl.test.launching.TestInvokerDaemon.main(TestInvokerDaemon.java:52)
[saker.java.test]    [email protected]/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[saker.java.test]    [email protected]/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[saker.java.test]    [email protected]/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[saker.java.test]    [email protected]/java.lang.reflect.Method.invoke(Method.java:564)
[saker.java.test]    saker.nest.action.main.MainCommand.call(MainCommand.java:189)
[saker.java.test]    saker.nest.action.main.ExecuteAction.lambda$parse$2(ExecuteAction.java:701)
[saker.java.test]    saker.nest.action.main.ExecuteAction$$Lambda$25/741669172.run(Unknown Source)
[saker.java.test]    saker.nest.action.main.ExecuteAction.callCommand(ExecuteAction.java:1022)
[saker.java.test]    saker.nest.action.main.ExecuteActionCommand.callCommand(ExecuteActionCommand.java:42)
[saker.java.test]    saker.nest.action.main.ExecuteActionCommand.invoke(ExecuteActionCommand.java:47)
[saker.java.test]    [email protected]/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[saker.java.test]    [email protected]/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[saker.java.test]    [email protected]/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[saker.java.test]    [email protected]/java.lang.reflect.Method.invoke(Method.java:564)
[saker.java.test]    saker.nest.NestRepositoryImpl.executeAction(NestRepositoryImpl.java:142)
[saker.java.test]    app//saker.build.runtime.repository.ForwardingSakerRepository.executeAction(ForwardingSakerRepository.java:53)
[saker.java.test]    saker.build.launching.RepositoryActionCommand.call(RepositoryActionCommand.java:203)
[saker.java.test]    saker.build.launching.Launcher.lambda$parse$9(Launcher.java:2324)
[saker.java.test]    saker.build.launching.Launcher$$Lambda$13/1864350231.run(Unknown Source)
[saker.java.test]    saker.build.launching.Launcher.callCommand(Launcher.java:2402)
[saker.java.test]    saker.build.launching.MainCommand.main(MainCommand.java:112)
[saker.java.test]    [email protected]/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[saker.java.test]    [email protected]/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[saker.java.test]    [email protected]/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[saker.java.test]    [email protected]/java.lang.reflect.Method.invoke(Method.java:564)
[saker.java.test]    app//saker.build.launching.Main.mainImpl(Main.java:131)
[saker.java.test]    app//saker.build.launching.Main.main(Main.java:73)
[saker.java.test]Thread: Thread[Signal Dispatcher,9,system]
[saker.java.test]Thread: Thread[Stderr printer,5,main]
[saker.java.test]    [email protected]/jdk.internal.misc.Unsafe.park(Native Method)
[saker.java.test]    [email protected]/java.util.concurrent.locks.LockSupport.park(LockSupport.java:194)
[saker.java.test]    [email protected]/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2075)
[saker.java.test]    app//saker.build.thirdparty.saker.util.io.ReadWriteBufferOutputStream.readLocked(ReadWriteBufferOutputStream.java:170)
[saker.java.test]    app//saker.build.thirdparty.saker.util.io.ReadWriteBufferOutputStream.read(ReadWriteBufferOutputStream.java:144)
[saker.java.test]    app//saker.build.thirdparty.saker.util.io.ReadWriteBufferOutputStream.read(ReadWriteBufferOutputStream.java:426)
[saker.java.test]    app//saker.build.thirdparty.saker.util.io.ByteSourceInputStream.read(ByteSourceInputStream.java:52)
[saker.java.test]    app//saker.build.thirdparty.saker.util.io.StreamUtils.copyStream(StreamUtils.java:745)
[saker.java.test]    app//saker.build.thirdparty.saker.util.io.StreamUtils.copyStream(StreamUtils.java:721)
[saker.java.test]    app//saker.build.thirdparty.saker.util.io.StreamUtils.copyStream(StreamUtils.java:699)
[saker.java.test]    saker.java.testing.impl.test.launching.SakerRMIDaemon.lambda$runServer$1(SakerRMIDaemon.java:106)
[saker.java.test]    saker.java.testing.impl.test.launching.SakerRMIDaemon$$Lambda$100/1239183618.run(Unknown Source)
[saker.java.test]    [email protected]/java.lang.Thread.run(Thread.java:844)
[saker.java.test]Thread: Thread[Common-Cleaner,8,InnocuousThreadGroup]
[saker.java.test]    [email protected]/java.lang.Object.wait(Native Method)
[saker.java.test]    [email protected]/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:151)
[saker.java.test]    [email protected]/jdk.internal.ref.CleanerImpl.run(Unknown Source)
[saker.java.test]    [email protected]/java.lang.Thread.run(Unknown Source)
[saker.java.test]    [email protected]/jdk.internal.misc.InnocuousThread.run(Unknown Source)
[saker.java.test]Thread: Thread[Test: testing.saker.build.tests.tasks.AddAncestorBlockingWaitTaskTest,5,Main sub group]
[saker.java.test]    [email protected]/java.lang.Object.wait(Native Method)
[saker.java.test]    [email protected]/java.lang.Thread.join(Thread.java:1353)
[saker.java.test]    [email protected]/java.lang.Thread.join(Thread.java:1427)
[saker.java.test]    testing.saker.build.tests.EnvironmentTestCase.runTest(EnvironmentTestCase.java:254)
[saker.java.test]    [email protected]/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[saker.java.test]    [email protected]/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[saker.java.test]    [email protected]/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[saker.java.test]    [email protected]/java.lang.reflect.Method.invoke(Method.java:564)
[saker.java.test]    testing.saker.SakerJavaTestingInvoker$1.run(SakerJavaTestingInvoker.java:108)
[saker.java.test]Thread: Thread[Finalizer,8,system]
[saker.java.test]    [email protected]/java.lang.Object.wait(Native Method)
[saker.java.test]    [email protected]/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:151)
[saker.java.test]    [email protected]/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:172)
[saker.java.test]    [email protected]/java.lang.ref.Finalizer$FinalizerThread.run(Unknown Source)
[saker.java.test]Thread: Thread[ClassPathLoadManager-cleaner,5,main]
[saker.java.test]    [email protected]/java.lang.Object.wait(Native Method)
[saker.java.test]    [email protected]/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:151)
[saker.java.test]    [email protected]/java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:172)
[saker.java.test]    app//saker.build.runtime.classpath.ClassPathLoadManager$CleanerRunnable.run(ClassPathLoadManager.java:327)
[saker.java.test]    [email protected]/java.lang.Thread.run(Thread.java:844)
[saker.java.test]java.io.IOException: java.lang.InterruptedException
[saker.java.test]	at saker.build.thirdparty.saker.util.io.IOUtils.addExc(IOUtils.java:573)
[saker.java.test]	at saker.build.util.cache.SakerDataCache.close(SakerDataCache.java:452)
[saker.java.test]	at saker.build.runtime.environment.SakerEnvironmentImpl.clearCachedDatasWaitExecutions(SakerEnvironmentImpl.java:479)
[saker.java.test]	at testing.saker.build.tests.EnvironmentTestCase.executeRunning(EnvironmentTestCase.java:443)
[saker.java.test]	at saker.build.thirdparty.saker.util.function.Functionals$SneakyThrowingRunnable.run(Functionals.java:145)
[saker.java.test]	at java.base/java.lang.Thread.run(Thread.java:844)
[saker.java.test]	at saker.build.thirdparty.saker.util.thread.ExceptionThread.runImpl(ExceptionThread.java:164)
[saker.java.test]	at saker.build.thirdparty.saker.util.thread.ExceptionThread.run(ExceptionThread.java:141)
[saker.java.test]Caused by: java.lang.InterruptedException
[saker.java.test]	at java.base/java.lang.Object.wait(Native Method)
[saker.java.test]	at java.base/java.lang.Thread.join(Thread.java:1353)
[saker.java.test]	at java.base/java.lang.Thread.join(Thread.java:1427)
[saker.java.test]	at saker.build.util.cache.SakerDataCache.close(SakerDataCache.java:449)
[saker.java.test]	... 6 more
[saker.java.test]java.lang.AssertionError: Test case failed: testing.saker.build.tests.tasks.AddAncestorBlockingWaitTaskTest
[saker.java.test]Caused by: java.lang.AssertionError: saker.build.task.exception.MultiTaskExecutionFailedException: StringTaskIdentifier[main]
[saker.java.test]	at testing.saker.build.tests.EnvironmentTestCase.executeRunning(EnvironmentTestCase.java:448)
[saker.java.test]	at saker.build.thirdparty.saker.util.function.Functionals$SneakyThrowingRunnable.run(Functionals.java:145)
[saker.java.test]	at java.base/java.lang.Thread.run(Thread.java:844)
[saker.java.test]	at saker.build.thirdparty.saker.util.thread.ExceptionThread.runImpl(ExceptionThread.java:164)
[saker.java.test]	at saker.build.thirdparty.saker.util.thread.ExceptionThread.run(ExceptionThread.java:141)
[saker.java.test]Caused by: saker.build.task.exception.MultiTaskExecutionFailedException: StringTaskIdentifier[main]
[saker.java.test]	at saker.build.task.exception.ExceptionAccessInternal.createMultiTaskExecutionFailedException(ExceptionAccessInternal.java:38)
[saker.java.test]	at saker.build.task.TaskExecutionManager.execute(TaskExecutionManager.java:4290)
[saker.java.test]	at saker.build.runtime.execution.ExecutionContextImpl.executeTask(ExecutionContextImpl.java:491)
[saker.java.test]	at saker.build.runtime.environment.SakerEnvironmentImpl$TaskRunnerThread.runWithContext(SakerEnvironmentImpl.java:919)
[saker.java.test]	at saker.build.runtime.environment.SakerEnvironmentImpl$TaskRunnerThread.run(SakerEnvironmentImpl.java:973)
[saker.java.test]	Suppressed: saker.build.task.exception.TaskExecutionFailedException: Task execution failed. (StringTaskIdentifier[blocker])
[saker.java.test]		at saker.build.task.exception.ExceptionAccessInternal.createTaskExecutionFailedException(ExceptionAccessInternal.java:34)
[saker.java.test]		at saker.build.task.TaskExecutionManager.createFailException(TaskExecutionManager.java:6777)
[saker.java.test]		at saker.build.task.TaskExecutionManager.executeTaskRunning(TaskExecutionManager.java:6333)
[saker.java.test]		at saker.build.task.TaskExecutionManager.executeNewTaskRunning(TaskExecutionManager.java:6799)
[saker.java.test]		at saker.build.task.TaskExecutionManager.lambda$executeExecutionWithStrategy$3(TaskExecutionManager.java:4907)
[saker.java.test]		at saker.build.task.TaskExecutionManager$TaskExecutionThread.run(TaskExecutionManager.java:4575)
[saker.java.test]	Caused by: java.lang.InterruptedException: Interrupted while waiting for: blocker_end in [waiter_end, blocker_end]
[saker.java.test]		at testing.saker.build.tests.ExecutionOrderer.enter(ExecutionOrderer.java:59)
[saker.java.test]		at testing.saker.build.tests.tasks.AddAncestorBlockingWaitTaskTest$BlockerStarterTaskFactory.run(AddAncestorBlockingWaitTaskTest.java:79)
[saker.java.test]		at testing.saker.build.tests.tasks.AddAncestorBlockingWaitTaskTest$BlockerStarterTaskFactory.run(AddAncestorBlockingWaitTaskTest.java:69)
[saker.java.test]		at saker.build.task.TaskInvocationManager.invokeTaskRunningOnLocalEnvironment(TaskInvocationManager.java:313)
[saker.java.test]		at saker.build.task.TaskInvocationManager.invokeTaskRunning(TaskInvocationManager.java:283)
[saker.java.test]		at saker.build.task.TaskExecutionManager.executeTaskRunning(TaskExecutionManager.java:6288)
[saker.java.test]		... 3 more
[saker.java.test]	Suppressed: java.lang.RuntimeException: Caller stacktrace.
[saker.java.test]		at testing.saker.build.tests.EnvironmentTestCase.getTaskResultCollectionThrow(EnvironmentTestCase.java:509)
[saker.java.test]		at testing.saker.build.tests.EnvironmentTestCase.runTask(EnvironmentTestCase.java:529)
[saker.java.test]		at testing.saker.build.tests.EnvironmentTestCase.runTask(EnvironmentTestCase.java:533)
[saker.java.test]		at testing.saker.build.tests.tasks.AddAncestorBlockingWaitTaskTest.runTestImpl(AddAncestorBlockingWaitTaskTest.java:100)
[saker.java.test]		at testing.saker.build.tests.EnvironmentTestCase.executeRunning(EnvironmentTestCase.java:431)
[saker.java.test]		at saker.build.thirdparty.saker.util.function.Functionals$SneakyThrowingRunnable.run(Functionals.java:145)
[saker.java.test]		at java.base/java.lang.Thread.run(Thread.java:844)
[saker.java.test]		at saker.build.thirdparty.saker.util.thread.ExceptionThread.runImpl(ExceptionThread.java:164)
[saker.java.test]		at saker.build.thirdparty.saker.util.thread.ExceptionThread.run(ExceptionThread.java:141)
[saker.java.test]
[saker.java.test]
[saker.java.test]Error: Test failed: testing.saker.build.tests.tasks.AddAncestorBlockingWaitTaskTest (2 minutes 0.014 seconds)

Sipkab added a commit that referenced this issue Jul 17, 2022
A thread handle might've gotten added multiple times to the
waitingThreads collections of a task future.

These changes probably doesnt fix the issues observed in #22, but
simplifies the deadlock checking in some aspects.
Sipkab added a commit that referenced this issue Jul 22, 2022
The threads that wait on a state of a task future are stored in a
collection. This collection got cleared when the task finished, and its
state was set to RESULT_READY. This operation was incorrect, as if some
threads wait on a notification about a new ancestor being added to a
task, then it will never get notified, as its thread handle got purged
from the collection.

This gets fixed by not clearing the waiting thread collection in case
the task finishes, so threads can get notified after finish.

The thread handles that are only interested in the RESULT_READY event
will still get removed not to keep them unnecessarily in the collection.

AddAncestorBlockingWaitTaskTest was extended to test this scenario. This
reliably happened when the str task finishes before the child starter
task (plus) can start it.

Related issue: #22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant