Skip to content

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

Closed
@glandium

Description

@glandium

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions