Skip to content

Race condition in task killing #1923

Closed
Closed
@brson

Description

@brson

If you run this enough times it will eventually fail: (EDIT by bblum: update to new closure syntax & new failure propagation semantics)

fn main() {
    for iter::repeat(100u) {
        let builder = task::builder();
        task::unsupervise(builder);
        do task::run(builder) {
            let po = comm::port();
            let ch = comm::chan(po);
            let builder = task::builder();
            task::unsupervise(builder);
            do task::run(builder) {
                comm::send(ch, ());
            }   
            do task::spawn {
                fail;
            }   
            comm::recv(po);
        }   
    }   
}
rust: fatal, 'task->get_state() == src' failed, ../src/rt/rust_task_thread.cpp:338

The race is between the two tasks, one that wants to unblock the third by killing it, the other by sending a message.

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

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions