[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
This commit is contained in:
Alexey Merkulov
2024-11-21 16:24:35 +00:00
committed by intellij-monorepo-bot
parent 2dc7844cab
commit 5d73c19f18
@@ -355,7 +355,7 @@ public final class DebuggerUtilsImpl extends DebuggerUtilsEx {
@NotNull ThrowableComputable<? extends T, ? extends EvaluateException> valueComputable,
@NotNull Function<? super T, ? extends R> 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();