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

Panic in Job causes Cargo to hang indefinitely. #6433

Closed
ehuss opened this issue Dec 13, 2018 · 1 comment · Fixed by #7366
Closed

Panic in Job causes Cargo to hang indefinitely. #6433

ehuss opened this issue Dec 13, 2018 · 1 comment · Fixed by #7366
Labels
A-cargo-api Area: cargo-the-library API and internal code issues

Comments

@ehuss
Copy link
Contributor

ehuss commented Dec 13, 2018

If a Job ever panics, Cargo will hang indefinitely. I've seen this a few times during development (and a recently exposed bug in metabuild).

The issue is that if this line ever panics:

let res = job.run(fresh, &JobState { tx: my_tx.clone() });

the following line never sends the Message::Finish message, and the main thread hangs waiting for the finish message.

Dealing with this is a little more difficult than I expected. catch_unwind can't be used because Message is not unwind safe due to the reference. Any ideas for an easy way to deal with it? Is this worth fixing?

@dwijnand dwijnand added the A-cargo-api Area: cargo-the-library API and internal code issues label Dec 14, 2018
@alexcrichton
Copy link
Member

This has definitely been annoying to debug in the past when I've run into it, but it ends up not being the hardest thing to track down once you set RUST_BACKTRACE=1 most of the time (and it comes up pretty rarely for me at least).

Perhaps the easiest thing though would be to use a destructor to send a finished message instead of an explicit statement?

bors added a commit that referenced this issue Sep 16, 2019
Don't hang when Cargo's worker threads panic

This shouldn't ever happen during normal development, but happens from
time to time while developing Cargo itself.

Closes #6433
@bors bors closed this as completed in 8a3c0fe Sep 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cargo-api Area: cargo-the-library API and internal code issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants