Skip to content
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

Console's offline flow seems broken with R when lldb is involved (Ark development, or R packages with C++) #6126

Open
DavisVaughan opened this issue Jan 27, 2025 · 1 comment
Labels
area: console Issues related to Console category. frontend Issues having to do with the frontend (Electron) part of a category

Comments

@DavisVaughan
Copy link
Contributor

DavisVaughan commented Jan 27, 2025

I've been having problems with the R is offline, waiting to reconnect + R reconnected flow.

It will often say it has reconnected but the Console is totally dead in the water, I can type but Enter won't have any affect. The code you see my type here sticks around even after pressing Enter.

test.mov

A few things of note:

  • The kernel supervisor sees us go offline, but then also flips us back to idle after the debugger "releases" ark, here are the logs:
15:56:18 [ERROR] [session r-963c060a] No heartbeat response received after 5s, marking kernel as offline.
15:56:18 [DEBUG] (12) kcserver::kernel_state: [session r-963c060a] status 'busy' => 'offline' (lost heartbeat)
15:56:22 [DEBUG] (12) kcserver::zmq_ws_proxy: [session r-963c060a] Forward from 'IOPub' to WebSocket: comm_msg
15:56:22 [DEBUG] (12) kcserver::zmq_ws_proxy: [session r-963c060a] Forward from 'Shell' to WebSocket: execute_reply
15:56:22 [DEBUG] (12) kcserver::zmq_ws_proxy: [session r-963c060a] Forward from 'IOPub' to WebSocket: comm_msg
15:56:22 [DEBUG] (12) kcserver::zmq_ws_proxy: [session r-963c060a] Forward from 'IOPub' to WebSocket: status
15:56:22 [DEBUG] (12) kcserver::kernel_state: [session r-963c060a] status 'offline' => 'idle' (execute_request)
  • It is expected that ark cannot send back heartbeats in this case. lldb is attached to ark and has locked it up, and that is normal behavior here.

  • There are no other logs that I can find that suggest that the front end part of the console is registering what I'm typing at all

Here is an easyish way to reproduce a similar problem:

  • Start an R console and get the pid with Sys.getpid()
  • Start lldb in another terminal and run attach --pid <pid>
  • Wait for the R Console to go "offline" over in positron, then exit lldb and detach from the process (or hit c to continue)

In this particular case I don't even get the "online" notification, so possibly this is a slightly different issue, but its basically doing the same thing as my first video.

Screen.Recording.2025-01-27.at.11.22.12.AM.mov
@DavisVaughan DavisVaughan added area: console Issues related to Console category. frontend Issues having to do with the frontend (Electron) part of a category labels Jan 27, 2025
@DavisVaughan
Copy link
Contributor Author

I'm now remembering the first time I saw this. This is actually extremely annoying for ark developers because this is the exact workflow we use when debugging ark:

  • Start R in Positron
  • Set a breakpoint in ark code
  • Trigger the breakpoint by running R code in the console
  • Step through code on the ark side (console goes offline here because debugger has ark locked up as we step through it)
  • Finish debugging and release the ark process
  • R Console never comes back online on the ark side

So basically we end up having to do a full restart of R after each attempt at debugging the R session in question

@DavisVaughan DavisVaughan changed the title Console's offline flow seems broken with R when debugging packages with C++ Console's offline flow seems broken with R when lldb is involved (Ark development, or R packages with C++) Jan 27, 2025
jmcphers added a commit that referenced this issue Jan 28, 2025
…#6133)

This change fixes an issue in which reconnection doesn't fully work for
sessions managed by the supervisor.

The issue appears to just be a typo made when porting from the
soon-to-be-extinct Jupyter Adapter, with the result that the connection
barrier (which holds operations until the kernel is back online) is not
opened even though the supervisor correctly detects that the kernel is
back online.

Addresses #6126


### Release Notes

#### New Features

- N/A

#### Bug Fixes

- Fix issue causing Console to become unresponsive after an interpreter
goes offline and then back online (#6126)

### QA Notes

The easiest way to repro this on macOS is to use `Sys.getpid()` in R and
then `lldb -p PID` to take the kernel offline. Type "c" at the LLDB
prompt to bring it back online; more notes in Davis's writeup.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: console Issues related to Console category. frontend Issues having to do with the frontend (Electron) part of a category
Projects
None yet
Development

No branches or pull requests

1 participant