Skip to content

Pipe should get terminated if a blocked receiver is killed & punted awake. #3168

Closed
@bblum

Description

@bblum

I claim the assert at the end here should not trip, yet it does.

fn main() {
    let (c,p) = pipes::stream();
    do task::try {
        let (c2,p2) = pipes::stream();
        do task::spawn {
            p2.recv();
            #error["brother fails"];
            fail;
        }   
        let (c3,p3) = pipes::stream();
        c.send(c3);
        c2.send(());
        #error["child blocks"];
        p3.recv();
    };  
    #error["parent tries"];
    assert !p.recv().try_send(());
}

Output: (note: only the first three lines are nondeterministic)

rust: ~"child blocks"
rust: ~"brother fails"
rust: task failed at 'explicit failure', pipe.rs:8
rust: task failed at 'killed', /home/bblum/rust/src/libcore/pipes.rs:284
rust: ~"parent tries"
rust: task failed at 'Assertion !p.recv().try_send(()) failed', pipe.rs:17
rust: domain main @0xd7eb80 root task failed

This is relevant for mutexes/cvars, exhibited here: https://github.com/mozilla/rust/blob/incoming/src/libcore/sync.rs#L490

I believe the fix should be in fn try_recv; somewhere in the loop, it should use a flagged destructor.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions