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

When supervisor does not start, show its output and provide an explanatory error #5611

Closed
jmcphers opened this issue Dec 4, 2024 · 1 comment
Labels
area:kallichore Issues related to the new kernel supervisor enhancement New feature or request support

Comments

@jmcphers
Copy link
Collaborator

jmcphers commented Dec 4, 2024

When the Jupyter kernel supervisor fails to start, the UX is not great. You get a toast letting you know that the terminal failed to start, and a message in the console that says we "failed to connect to Kallichore." That's not super helpful for most users.

It should be rare that the supervisor fails to start, but it is possible, so we should make sure that the experience isn't bad. Specifically, we should:

  1. Show any output that was emitted during the launch, so the user can see the error that led to the launch failing. In the example below, this would have shown a glibc or openssl error due to OS level incompatibility. Since VS Code's Terminal API doesn't provide a way to show the output of failed commands, this will require running the server under a wrapper script to capture its output, as we used to do for Jupyter kernels.
  2. Have the Console show a more reasonable message that doesn't use code names.

Originally via discussion (see below); in this case, it was expected that the server won't start due to Linux incompatibility (#3854).

Discussed in #5605

Originally posted by fabian-s December 4, 2024
Error message:

The terminal process "/usr/share/positron/resources/app/extensions/positron-supervisor/resources/kallichore/kcserver '--port', '62076', '--token', '/tmp/kallichore-d532b7ab.token', '--log-level', 'debug', '--log-file', '/tmp/kallichore-d532b7ab.log'" failed to launch (exit code: 127).

Screenshot:

image

This is on Linux Mint 20.

@jmcphers jmcphers added the area:kallichore Issues related to the new kernel supervisor label Dec 4, 2024
@juliasilge juliasilge added enhancement New feature or request support labels Dec 4, 2024
@juliasilge juliasilge added this to the Release Candidate milestone Dec 9, 2024
jmcphers added a commit that referenced this issue Dec 12, 2024
This change improves diagnostics and logging for (hopefully rare) cases
in which the kernel supervisor _itself_ cannot start. This is distinct
from the cases where R or Python can't start. So far we've seen just one
of these in the wild, as a result of running on an unsupported OS.

The approach is to borrow the wrapper script technique from the Jupyter
Adapter (formerly used to invoke the kernels themselves). The wrapper
script acts as a sort of supervisor for the supervisor; it eats the
output of the supervisor process and writes it to a file. If the
supervisor exits unexpectedly at startup, the output file is written to
the log channel, and the user is directed there to view errors.

As an additional benefit, this runs the supervisor under a `bash`
process on Unix-alikes, so any environment variables or configuration
set up in `.bashrc` (etc) will now be available to the supervisor.

Addresses #5611 . 

May help us figure out #5337.

### QA Notes

An easy way to test this is to replace your `kcserver` binary with a
shell script that emits some nonsense and then exits immediately with a
nonzero status code. If you're feeling ambitious, you could also test
this on the OS named in #5611.

Also, did you know that the [longest worm in the
world](https://en.wikipedia.org/wiki/Lineus_longissimus) can reach up to
55 meters? Crazy.
@testlabauto
Copy link
Contributor

Verified Fixed

Positron Version(s) : 2025.01.0-104
OS Version          : OSX

Test scenario(s)

Image

Used same kcserver contents as Pete

Image

Link(s) to TestRail test cases run or created:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:kallichore Issues related to the new kernel supervisor enhancement New feature or request support
Projects
None yet
Development

No branches or pull requests

3 participants