From 5d73c19f180a2a109e777a5b79a8b570642d9003 Mon Sep 17 00:00:00 2001 From: Alexey Merkulov Date: Mon, 21 Oct 2024 16:08:42 +0200 Subject: [PATCH] [debugger] Increase trys on ObjectCollectedException before suspend-all evaluation applied Such low-level suspend-all evaluation is dangerous because it can lead to deadlock in the user application without a way to restore (cherry picked from commit 371320ba59de3c5f16c2fb7d455a0f662221cf45) IJ-CR-147314 GitOrigin-RevId: c07aa55155db8b2a0568b62a4afdad20f40f654f --- .../impl/src/com/intellij/debugger/impl/DebuggerUtilsImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerUtilsImpl.java b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerUtilsImpl.java index 234848e0fbd6..30cebbd651e5 100644 --- a/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerUtilsImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerUtilsImpl.java @@ -355,7 +355,7 @@ public final class DebuggerUtilsImpl extends DebuggerUtilsEx { @NotNull ThrowableComputable valueComputable, @NotNull Function processor, @NotNull EvaluationContext evaluationContext) throws EvaluateException { - int retries = 1; + int retries = 3; while (true) { T result = valueComputable.compute(); try { @@ -363,6 +363,7 @@ public final class DebuggerUtilsImpl extends DebuggerUtilsEx { } catch (ObjectCollectedException oce) { if (--retries < 0) { + LOG.error("Retries exhausted, apply suspend-all evaluation"); if (evaluationContext.getSuspendContext() instanceof SuspendContextImpl suspendContextImpl) { VirtualMachineProxyImpl virtualMachineProxy = suspendContextImpl.getVirtualMachineProxy(); virtualMachineProxy.suspend();