Skip to content

Conversation

@zanieb
Copy link
Member

@zanieb zanieb commented Jan 27, 2025

Closes #10952

@zanieb zanieb added the bug Something isn't working label Jan 27, 2025
// Ignore signals in the parent process, deferring them to the child. This is safe as long as
// the command is the last thing that runs in this process; otherwise, we'd need to restore the
// signal handlers after the command completes.
let _handler = tokio::spawn(async { while tokio::signal::ctrl_c().await.is_ok() {} });
Copy link
Member Author

Choose a reason for hiding this comment

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

Need to figure out what this means for Windows before ready for review.

Comment on lines +29 to +34
_ = int_signal.recv() => {
int_signal_count += 1;
if int_signal_count > 1 {
let _ = interrupt_process(&mut handle);
}
},
Copy link
Member Author

Choose a reason for hiding this comment

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

I'd like to understand why Ctrl-C isn't working in #10952 but works in other cases, but... it seems generally correct to forward a SIGINT if we've received it multiple times (as an escape hatch).

break result;
},

// TODO(zanieb: Refactor `interrupt_process` and `terminate_process` to use
Copy link
Member Author

Choose a reason for hiding this comment

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

Keeping this separate for review purposes.

@zanieb zanieb closed this Jan 28, 2025
zanieb added a commit that referenced this pull request Jan 28, 2025
There should be two functional changes here:

- If we receive SIGINT twice, forward it to the child process
- If the `uv run` child process changes its PGID, then forward SIGINT

Previously, we never forwarded SIGINT to a child process. Instead, we
relied on shell to do so.

On Windows, we still do nothing but eat the Ctrl-C events we receive.
I cannot see an easy way to send them to the child.

The motivation for these changes should be explained in the comments.

Closes #10952 (in which Ray
changes its PGID)
Replaces the (much simpler) #10989 with a more comprehensive approach.

See #6738 (comment)
for some previous context.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

uv run not stopping ray serve with ctrl c

2 participants