Skip to content

Calling spawn too many times crashes the program #15895

Closed
@tomaka

Description

@tomaka

If you use native threads and call spawn() too many times, the program will simply crash with application terminated abnormally with signal 9 (Killed).

Example:

fn main() {
    use std::io::timer;
    use std::iter;

    for i in iter::count(1u, 1) {
        println!("thread num: {}", i);
        spawn(proc() {
            timer::sleep(10000)
        })
    }
}

A try_spawn(proc():Send) -> Result<(), ()> could be a good addition too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-runtimeArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions