oracle / truffleruby

A high performance implementation of the Ruby programming language, built on GraalVM.
https://www.graalvm.org/ruby/
Other
3.02k stars 185 forks source link

VS Code debugger blocks rendering local variables #2725

Open nirvdrum opened 2 years ago

nirvdrum commented 2 years ago

I'm trying to debug a Rails application with a bunch of middleware, using the GraalVM Tools for Java plugin for VS Code. I've set a breakpoint on the chained @app.call in a middleware's call method. The local variables take a long time to render (I've seen > 2 minutes). The slow variable loading is a performance issue that we'll need to resolve. But, it also appears to block any stepping in the debugger. I'm unable to step into or over a line or tell the debugger to run until it hits the next breakpoint until the local variables view finishes loading.

I've tried collapsing both the "Local" section under "Variables" and the "Variables" section entirely, which I hoped to signal to the debugger that this request can be interrupted. I think any stepping should cancel the current local variable fetch. I'm not sure if this is an issue with the tooling API or our implementation of it.

eregon commented 2 years ago

I think it's very difficult/impossible to cancel ongoing interop messages for local variables. But, obviously they should be faster. Another idea would be to run that in a different thread, but that wouldn't work for single-threaded languages.

It would be helpful to have a look with a Java profiler to see what's slow. For example https://github.com/graalvm/mx/blob/master/README-proftool.md works nicely on Linux with this small change: https://github.com/graalvm/mx/compare/master...eregon:mx:bd/proftool-truffle-launcher