-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only restart runtimes on RuntimeExitReason.Error
#3032
Conversation
This would rely heavily on correctly reading the error code off the process, i.e. this code positron/extensions/jupyter-adapter/src/JupyterKernel.ts Lines 1449 to 1478 in 7b71e16
|
This avoids the annoying toast notifications like "Cannot call write after a stream was destroyed" and "read ECONNRESET", which are instead logged to our output channel.
@jmcphers with 1663456, the toast notifications that appear at second 18 in the video that occasionally popped up should no longer appear - instead they are only logged to our LSP output channel. That should ensure that It had to do with this case in the middleware: If we don't tell the middleware that we are "handling" the error, then it sets It was essentially the same issue as #2880, but coming at it from a different angle. It is worth noting that this idea of "indicating shutdown from the kernel side" was also discussed in the jupyter-client repo, and they also came up with the idea of using an exit code of |
I now believe this is enough to "address" #628 and have updated it to reflect that In theory an even better long term solution was if our LSP server ran in a separate process that communicates with the R process to get information like global env completions but would not fall down if R crashes or quits. That way, only the |
Addresses #628
I realized that when
q()
is called in R, we do actually know that the exit code was0
, and we treat this as anUnknown
exit reason (by definition,Unknown
also means an exit code of0
, otherwise it would have been upgraded to anError
).I think pretty much all of the expected cleanup is already happening on the Positron side when
q()
is called, the only weird thing is that we are treating anUnknown
exit like a crash and automatically restarting.It turns out that we can fix that pretty easily by only auto-restarting when the exit reason is
Error
, where previously we restarted if the exit reason isError
ORUnknown
.I think we should treat
Unknown
as more of an "expected" case where the shutdown was initiated by the kernel. I would be in favor of possibly changing the name ofUnknown
toBackendShutdown
or something, and then changeShutdown
toFrontendShutdown
? i.e. here:positron/src/vs/workbench/services/languageRuntime/common/languageRuntimeService.ts
Lines 312 to 338 in 7b71e16
Screen.Recording.2024-05-06.at.6.32.09.PM.mov