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

process: drop pipe after child exits in wait_with_output #4315

Merged
merged 2 commits into from
Jan 10, 2022

Conversation

Darksonn
Copy link
Contributor

Drop the stdout/stderr pipes after the child has exited in wait_with_output. This will supposedly avoid a crash in some rare circumstances as discussed in #4309.

@Darksonn Darksonn added A-tokio Area: The main tokio crate M-process Module: tokio/process labels Dec 12, 2021
Copy link
Member

@ipetkov ipetkov left a comment

Choose a reason for hiding this comment

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

I'm still not entirely sure why delaying the IO handle drop would help, but we can easily try it out.

@iitalics
Copy link

I'm with you, I'd rather understand what's going on before jumping to a fix like this.

@Darksonn
Copy link
Contributor Author

@iitalics You should be able to try out the version of Tokio available in this PR by adding the following to your Cargo.toml.

[patch.crates-io]
tokio = { git = "https://github.com/tokio-rs/tokio.git", branch = "wait_with_output_oom" }

If you're able to compare how it performs with and without this change without any other changes, that would be cool.

@iitalics
Copy link

I've tested this for about an hour with no crash observed.

@Darksonn
Copy link
Contributor Author

Okay, if adding/removing this patch makes the crash go away and come back, then it seems reasonable to merge this. Not that it makes any sense.

@Darksonn Darksonn merged commit 1601de1 into master Jan 10, 2022
@Darksonn Darksonn deleted the wait_with_output_oom branch January 10, 2022 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate M-process Module: tokio/process
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants