Clean up debug session lifecycle#10333
Conversation
Signed-off-by: Thomas Mäder <tmader@redhat.com>
Signed-off-by: Thomas Mäder <tmader@redhat.com>
|
Great catch, @alvsan09. Does the tool show which references retain the leaked objects? |
The tool itself does not provide you with the facility to move up to the containing references (as far as I can see), |
I was wrong about the facilities of the tool, look at the bottom of the page inside Memory "Retainers", |
|
It looks like the debug console session never disposes the completion provider it registers with monaco. It looks like this is is not a new bug, but should be trivial to fix. |
|
@msujew while cleaning up sessions, I'm getting stuck at console-session.ts#118 ff. but we have to let go of the session once it is disposed. If we need to retain something beyond the lifecycle of the debug session, we have to retain it outside of the debug session. |
|
|
@tsmaeder I see, that makes sense. I'm not totally against removing the last session if it closes. I implemented it this way, since that's how it seemed to work in vscode. When ending the last active debug session, the console would still display the latest session's text. However, when removing the last debug session console, Theia loses the text as well. I'm alright with you removing the last session as well, I'm sure we'll find another way to persist the last session's text in the debug console somehow later (in a separate PR). |
thegecko
left a comment
There was a problem hiding this comment.
Still pending testing with our debug adapter, but have added a few minor comments.
|
|
||
| /** | ||
| * The interface for describing the connection between plugins and main side. | ||
| * [IWebSocket](#IWebSocket) implementation over RPC. |
There was a problem hiding this comment.
nit: IWebSocket isn't used any more here
|
@tsmaeder where possible, please ensure common code (which doesn't use node features) is kept in the common folder. See #10163 (comment) |
As far as I can tell, VS code keeps debug sessions after they are closed. However, I don't think the debug console session would react properly if we tried to evaluate an expression on a closed debug session, for example.
In general, what's the lifecycle of console sessions? Do they stick around after the process they are bound to terminates? I think the relationship between the console session and the counterpart that it gets output from is similar. |
Signed-off-by: Thomas Mäder <tmader@redhat.com>
Signed-off-by: Thomas Mäder <tmader@redhat.com>
Signed-off-by: Thomas Mäder <tmader@redhat.com>
Signed-off-by: Thomas Mäder <tmader@redhat.com>
Signed-off-by: Thomas Mäder <tmader@redhat.com>
msujew
left a comment
There was a problem hiding this comment.
Looks good to me 👍
- Common debug adapters (js, markdown-debug) work well with the changes
- Malfunctioning debug adapters are closed when a timeout is reached
@thegecko Did you test the changes with a C debug adapter/cortex-debug? I wasn't able to get mine to work correctly.
No, I tested a proprietary adapter we are developing |
paul-marechal
left a comment
There was a problem hiding this comment.
I think we would benefit from merging #10265 before this one?
I have now and it still works |
Signed-off-by: Thomas Mäder <tmader@redhat.com>
|
@tsmaeder CI is red you may need to remove an import. Also, do you feel this should land in 1.20.0 being released today or can this wait for 1.21.0? |
Signed-off-by: Thomas Mäder <tmader@redhat.com>




What it does
Reworks the lifecycle of debug session related objects to be more reliable for edge cases. Fixes #10164
The fix consists of multiple changes:
DebugAdapterSessionobject. Once that object goes away, all related objects in the back-end and front-end go away.How to test
I've tested these changes by using the newest VS Code Java/java debug extensions, the jsdebug typescript debugger and the mock debug extension from #10163
It would be interesting to extend the testing to other debuggers I'm less familiar with, in particular C++ or python, for example. The relevant scenarios are stop and restart actions, as well as killing debuggees or debug adapters.
Review checklist
Reminder for reviewers