Skip to content

Failling assertion in oneshot abort_selection with native threads. #12802

Closed
@ghost

Description

The exact assert I am seeing fail is:

task '<unnamed>' failed at 'assertion failed: self.data.is_none()', /build/buildd/rust-nightly-201403090405~e1681df~precise/src/libstd/comm/oneshot.rs:346

If a task waits on a select and one of the channels is new (still in OneShot mode), and that channel is sent two messages before the other task is scheduled. This assertion will be triggered.

Code to reproduce:

extern crate native;

use std::io::timer::Timer;
use std::comm::{Chan, Select};

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

fn select_task(p: &Port<()>)
{
    let mut timer = Timer::new().unwrap();

    timer.sleep(25);

    let select = Select::new();
    let mut handle = select.handle(p);
    unsafe {handle.add()};

    let _ = select.wait();
    return;
}

fn main()
{
    let mut timer = Timer::new().unwrap();

    let (p, c) = Chan::new();
    spawn(proc() {
        select_task(&p)
    });

    timer.sleep(50);
    c.send(());
    c.send(());
}

Activity

sfackler

sfackler commented on Mar 10, 2014

@sfackler
Member
added a commit that references this issue on Mar 10, 2014
054e237
alexcrichton

alexcrichton commented on Mar 10, 2014

@alexcrichton
Member

Thanks for the small test case to reproduce!

added a commit that references this issue on Jul 25, 2022

Auto merge of rust-lang#12802 - rust-lang:jonas-schievink-patch-1, r=…

added 2 commits that reference this issue on May 30, 2024
fc2f703

Auto merge of rust-lang#12804 - B14CK313:master, r=y21

ea535c9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @alexcrichton@sfackler

      Issue actions

        Failling assertion in oneshot abort_selection with native threads. · Issue #12802 · rust-lang/rust