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

Exit the process a short time after entering our ctrl-c handler #125523

Merged
merged 1 commit into from
May 26, 2024

Conversation

saethlin
Copy link
Member

Fixes #124212

r? @bjorn3

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 24, 2024
@bjorn3
Copy link
Member

bjorn3 commented May 25, 2024

Thanks!

@bors r+

@bors
Copy link
Contributor

bors commented May 25, 2024

📌 Commit f1a18da has been approved by bjorn3

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 25, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request May 25, 2024
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#121377 (Stabilize `LazyCell` and `LazyLock`)
 - rust-lang#122986 (Fix c_char on AIX)
 - rust-lang#123803 (Fix `VecDeque::shrink_to` UB when `handle_alloc_error` unwinds.)
 - rust-lang#124080 (Some unstable changes to where opaque types get defined)
 - rust-lang#124667 (Stabilize `div_duration`)
 - rust-lang#125472 (tidy: validate LLVM component names in tests)
 - rust-lang#125523 (Exit the process a short time after entering our ctrl-c handler)

r? `@ghost`
`@rustbot` modify labels: rollup
// of time exit the process. This sleep+exit ensures that even if nobody is checking
// CTRL_C_RECEIVED, the compiler exits reasonably promptly.
CTRL_C_RECEIVED.store(true, Ordering::Relaxed);
std::thread::sleep(Duration::from_millis(100));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this has a change in behavior which I think may not be intentional: if the user hits Ctrl C twice, it will still wait 100 ms instead of exiting immediately

Copy link
Member Author

@saethlin saethlin May 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's intentional. You could definitely argue that it is bad, if you want.

I added the behavior of immediately exiting on the second ctrl-c because I thought it would be the obvious thing to try if the compiler didn't respond to the first. At least the most recent issue #125428 indicates this is either not obvious or prevented in some scenarios.

100 ms is a long time for a program, but significantly shorter than even an athlete's reaction time. Unless the OS scheduler truly hates us, the process should exit before the user even has time to realize the process didn't immediately exit and send a second ctrl-c.

@bors bors merged commit 0ded36f into rust-lang:master May 26, 2024
6 checks passed
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request May 26, 2024
Rollup merge of rust-lang#125523 - saethlin:ctrlc-timeout, r=bjorn3

Exit the process a short time after entering our ctrl-c handler

Fixes rust-lang#124212

r? `@bjorn3`
@rustbot rustbot added this to the 1.80.0 milestone May 26, 2024
@saethlin saethlin deleted the ctrlc-timeout branch May 26, 2024 00:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The compiler keeps going on Ctrl-C
5 participants