Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failling assertion in oneshot abort_selection with native threads. #12802

Closed
ghost opened this issue Mar 10, 2014 · 2 comments
Closed

Failling assertion in oneshot abort_selection with native threads. #12802

ghost opened this issue Mar 10, 2014 · 2 comments

Comments

@ghost
Copy link

ghost commented Mar 10, 2014

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(());
}
@sfackler
Copy link
Member

cc @alexcrichton

alexcrichton added a commit to alexcrichton/rust that referenced this issue Mar 10, 2014
The assertion was erroneously ensuring that there was no data on the port when
the port had selection aborted on it. This assertion was written in error
because it's possible for data to be waiting on a port, even after it was
disconnected. When aborting selection, if we see that there's data on the port,
then we return true that data is available on the port.

Closes rust-lang#12802
@alexcrichton
Copy link
Member

Thanks for the small test case to reproduce!

bors added a commit to rust-lang-ci/rust that referenced this issue Jul 25, 2022
…jonas-schievink

minor: Remove macro ABI version from doc comment

It's hard to remember to keep this in sync, but since the file path already contains the version, this comment is pretty unnecessary.
bors pushed a commit to rust-lang-ci/rust that referenced this issue May 30, 2024
The utility function `clippy_utils::fulfill_or_allowed` is not used because
using it would require to move the check for allowed after the check
iterating over all inherent impls of the type, doing possibly
unnecessary work.
Instead, `is_lint_allowed` is called as before, but additionally, once
certain that the lint should be emitted, `span_lint_hir_and_then` is called
instead of `span_lint_and_help` to also fulfill expectations.

fixes: rust-lang#12802

changelog: fulfill expectations in `check_unsafe_derive_deserialize`
bors added a commit to rust-lang-ci/rust that referenced this issue May 30, 2024
fulfill expectations in `check_unsafe_derive_deserialize`

The utility function `clippy_utils::fulfill_or_allowed` is not used because using it would require to move the check for allowed after the check iterating over all inherent impls of the type, doing possibly unnecessary work.
Instead, `is_lint_allowed` is called as before, but additionally, once certain that the lint should be emitted, `span_lint_hir_and_then` is called instead of `span_lint_and_help` to also fulfill expectations.

Note: as this is my first contribution, please feel free to nitpick or request changes. I am happy to adjust the implementation.

fixes: rust-lang#12802

changelog: fulfill expectations in [`unsafe_derive_deserialize`]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants