debug icon indicating copy to clipboard operation
debug copied to clipboard

Debugger exceptions crash the debugger and disconnect from the client

Open amomchilov opened this issue 2 years ago • 1 comments

Your environment

  • ruby -v: ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin22]
  • rdbg -v: rdbg 1.8.0 {:mode=>:start, :no_color=>nil}

Describe the bug Developing the CDP/DAP servers can be quite tedious, because any mistakes can raise exceptions that aren't caught, crash the server, and disconnect your IDE. Each time it requires restarting your debugger session.

To Reproduce

Add a raise anywhere in the protocol servers, e.g. where variables are rendered.

Expected behavior A error response to be sent to the client, which can display a message with error details.

Instead, the exception is raised, the debug adapter crashes, and the client disconnects.

Additional context

I played around with implementing this here, and got it working for the :scope and :variables requests.

It's pretty fiddly, it looks like each when branch needs to be wrapped in a separate begin/rescue block, which is quite tedious. I wonder if there's a more central place to rescue it.

It would also need to be implemented twice, because of all this logic is duplicated between the DAP and CDP servers.

amomchilov avatar Jul 28 '23 16:07 amomchilov

We noticed that this is also happening quite often with the devs in the company. :up:

niltonvasques avatar Aug 16 '23 19:08 niltonvasques