Skip to content

rustuv deadlocks at shutdown when spawning a "daemon" subprocess #14457

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

Closed
glandium opened this issue May 27, 2014 · 2 comments
Closed

rustuv deadlocks at shutdown when spawning a "daemon" subprocess #14457

glandium opened this issue May 27, 2014 · 2 comments

Comments

@glandium
Copy link
Contributor

To work around #14410, I'm using forget() to make a subprocess stay up longer than its (rust) parent. But while that works with libnative, that deadlocks on shutdown with rustuv. It's not even wait()ing on its child, because once the child quits, it's still stuck.

extern crate green;
extern crate rustuv;

use std::io::process;
use std::io::process::Command;

#[start]
fn start(argc: int, argv: **u8) -> int {
    green::start(argc, argv, rustuv::event_loop, main)
}

fn main() {
    let process = Command::new("sleep")
        .arg("10")
        .stdin(process::Ignored)
        .stdout(process::Ignored)
        .stderr(process::Ignored)
        .detached()
        .spawn()
        .ok();
    unsafe { std::mem::forget(process); }
}

If you wait the 10 seconds it takes for sleep to end, the above test program still is stuck.

@huonw
Copy link
Member

huonw commented May 27, 2014

I personally don't think we need to be guaranteeing that (a) rustuv works correctly without running destructors, or (b) that the behaviour of green and native match in every scenario (especially one like this).

cc @alexcrichton

@alexcrichton
Copy link
Member

Closing, forget is an unsafe function which is not intended to be used for something like this. This is basically waiting for #13854 to be resolved.

flip1995 pushed a commit to flip1995/rust that referenced this issue Apr 3, 2025
"paren" is used throughout the Clippy codebase as an abbreviation for
"parentheses".

changelog: none
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

No branches or pull requests

3 participants