From d2295138032dabb847025841ab990e051e29a595 Mon Sep 17 00:00:00 2001 From: "Ilya.Usov" Date: Thu, 19 Oct 2023 13:49:11 +0200 Subject: [PATCH] Allow termination under execution because of reentrancy in tests. Callback can be executed synchronously inside `send` --- .../src/main/kotlin/com/jetbrains/rd/framework/impl/RdTask.kt | 2 +- rd-net/RdFramework/Tasks/RdCall.cs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/rd-kt/rd-framework/src/main/kotlin/com/jetbrains/rd/framework/impl/RdTask.kt b/rd-kt/rd-framework/src/main/kotlin/com/jetbrains/rd/framework/impl/RdTask.kt index 0ae441d99..6ea884525 100644 --- a/rd-kt/rd-framework/src/main/kotlin/com/jetbrains/rd/framework/impl/RdTask.kt +++ b/rd-kt/rd-framework/src/main/kotlin/com/jetbrains/rd/framework/impl/RdTask.kt @@ -369,7 +369,7 @@ class RdCall(internal val requestSzr: ISerializer = Polymorphi val task = CallSiteWiredRdTask(intersectedDef.lifetime, this, taskId, scheduler ?: proto.scheduler) task.result.advise(intersectedDef.lifetime) { if (it !is RdTaskResult.Success || !it.value.isBindable()) { - intersectedDef.terminate() + intersectedDef.terminate(true) } } intersectedDef.lifetime.executeIfAlive { diff --git a/rd-net/RdFramework/Tasks/RdCall.cs b/rd-net/RdFramework/Tasks/RdCall.cs index 1d5316fb9..c048e305a 100644 --- a/rd-net/RdFramework/Tasks/RdCall.cs +++ b/rd-net/RdFramework/Tasks/RdCall.cs @@ -205,7 +205,10 @@ private IRdTask StartInternal(Lifetime requestLifetime, TReq request, ISch task.Result.Advise(intersectedDef.Lifetime, result => { if (result.Status != RdTaskStatus.Success || !result.Result.IsBindable()) + { + intersectedDef.AllowTerminationUnderExecution = true; intersectedDef.Terminate(); + } }); using var cookie = intersectedDef.UsingExecuteIfAlive();