positron icon indicating copy to clipboard operation
positron copied to clipboard

Reloading with busy runtime looks frozen, breaks LSP

Open jmcphers opened this issue 2 years ago • 5 comments

To reproduce:

  1. Start R
  2. Run Sys.sleep(60) or another long-running command
  3. Reload the Positron window (Cmd+R or Reload Window)
  4. Attempt to run another R command

It looks like you can run another R command, but you can't. The runtime appears to be frozen.

https://github.com/posit-dev/positron/assets/470418/d214ba80-fb11-4b78-b0b7-c1ff349c9de6

Shortly after reload, the LSP also fails to start:

image

The source of both of these problems is that Positron is trying to reconnect to a runtime that is busy running code, but Positron doesn't know it's busy running code. Consequently we don't show any busy UI, we offer an input prompt, and we try to start the LSP (which is not something you can do during a computation, at least not in R).

The right solution to this probably requires an intermediary layer (as in #1155), but perhaps as a stopgap we can implement it directly in the language packs in some way.

jmcphers avatar Sep 05 '23 23:09 jmcphers

I see exactly the same behaviour in Python

seeM avatar Sep 06 '23 07:09 seeM

This is necessary for Posit Workbench support; without it, if you close the browser while a computation is running and later reconnect, Python/R will be frozen until the computation is completed. This is very undesirable.

jmcphers avatar Oct 18 '23 00:10 jmcphers

I have a change on a branch that addresses this using the new Jupyter kernel supervisor.

jmcphers avatar Oct 01 '24 21:10 jmcphers

Update: In my testing this works OK for Python. R is better -- it does wait to reattach the LSP until R isn't busy -- but when it does reattach the LSP it crashes ark. This may be an ark bug or may be an ordering issue we can/should resolve on the Positron side.

jmcphers avatar Oct 08 '24 16:10 jmcphers

Ready to verify for Python; I'll open a separate bug for R as noted above. Note that you'll need to enable the new supervisor to verify!

jmcphers avatar Oct 09 '24 15:10 jmcphers

With the new supervisor enabled, it now waits for the running command to finish, and pops a toast message .

jonvanausdeln avatar Oct 15 '24 17:10 jonvanausdeln