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

Catch panics in the server and transmit them as errors to the client. #1981

Merged
merged 1 commit into from
Nov 23, 2023

Conversation

glandium
Copy link
Collaborator

Currently, when the server panics, the client never gets a response, and the compilation gets stuck. The only indication of something going wrong is in the logs if they are enabled.

With this change, the error is transmitted to the client, which then fails and prints it. For instance, one of the out-of-bound accesses fixed in #1980 now prints this on the client side before returning a non-zero exit code:

sccache: encountered fatal error
sccache: error: thread 'tokio-runtime-worker' panicked at src/compiler/c.rs:612:25: range end index 7 out of range for slice of length 1
sccache: caused by: thread 'tokio-runtime-worker' panicked at src/compiler/c.rs:612:25: range end index 7 out of range for slice of length 1

Fixes #756

@codecov-commenter
Copy link

codecov-commenter commented Nov 22, 2023

Codecov Report

Attention: 21 lines in your changes are missing coverage. Please review.

Comparison is base (68d0409) 30.69% compared to head (1569897) 30.60%.

Files Patch % Lines
src/server.rs 30.00% 18 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1981      +/-   ##
==========================================
- Coverage   30.69%   30.60%   -0.09%     
==========================================
  Files          51       51              
  Lines       19192    19215      +23     
  Branches     9230     9248      +18     
==========================================
- Hits         5891     5881      -10     
- Misses       7760     7790      +30     
- Partials     5541     5544       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@glandium glandium force-pushed the panic branch 2 times, most recently from d004af4 to 6f0514a Compare November 22, 2023 22:13
Currently, when the server panics, the client never gets a response, and
the compilation gets stuck. The only indication of something going wrong
is in the logs if they are enabled.

With this change, the error is transmitted to the client, which then
fails and prints it. For instance, one of the out-of-bound accesses
fixed in mozilla#1980 now prints this on the client side before returning a
non-zero exit code:

sccache: encountered fatal error
sccache: error: thread 'tokio-runtime-worker' panicked at src/compiler/c.rs:612:25: range end index 7 out of range for slice of length 1
sccache: caused by: thread 'tokio-runtime-worker' panicked at src/compiler/c.rs:612:25: range end index 7 out of range for slice of length 1

Fixes mozilla#756
@sylvestre sylvestre merged commit 240c38f into mozilla:main Nov 23, 2023
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

handle panics in the (local) server by failing the compilation rather than hanging
3 participants