graal icon indicating copy to clipboard operation
graal copied to clipboard

Add option to set a timeout for suspended debugger sessions

Open KaminskiDaniel0 opened this issue 1 year ago • 2 comments

Problem formulation

When using the chrome inspector to debug the evaluation of a Source in a Context with the property "inspect.Suspend" set to "true" the evaluation will wait indefinitely if the inspector is not closed or the debugging process terminated. Setting sandbox options like "sandbox.MaxCPUTime" does not work around this issue because suspending the debugger in the thread means it does not use up CPU time.

Possible solution Setting a dedicated timeout for suspended evaluations regardless of any resource usage parameters as discussed in this Slack-Thread would be very helpful.

Profiteers Developers of applications that enable their users to run their own custom code in a dedicated environment would benefit greatly from this option because it enables them to easily control debugging sessions and protect their application from too many idling debuggers.

Alternative solution An alternative but more complicated approach is also discussed in this Slack-Thread. One could intercept the inspector messages and manually close it.

KaminskiDaniel0 avatar Jan 15 '24 15:01 KaminskiDaniel0

@KaminskiDaniel0 what is the intended behavior after the new debugger-specific timeout expires? Is canceling of the debugger session enough? Or would you expect also an automatic termination of the application together with the debugger detach?

entlicher avatar Jun 27 '24 11:06 entlicher

@entlicher I would expect the debugger to be detached and the context execution to resume and complete normally. That way we do not lose any results by accidentally forgetting to resume the debugging-session and such.

KaminskiDaniel0 avatar Jun 27 '24 12:06 KaminskiDaniel0

This is fixed by https://github.com/oracle/graal/commit/e1f81a946c5b83c960bbea847f06a0cc52731927.

entlicher avatar Sep 24 '24 09:09 entlicher