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

MPMC queue deadlocks #17

Open
ghost opened this issue Aug 15, 2017 · 4 comments
Open

MPMC queue deadlocks #17

ghost opened this issue Aug 15, 2017 · 4 comments

Comments

@ghost
Copy link

ghost commented Aug 15, 2017

The following code deadlocks on my machine. You might have to run several times to hit the bug.

extern crate crossbeam;
extern crate multiqueue;

fn main() {
    const MESSAGES: usize = 1_000_000;
    const THREADS: usize = 2;

    let (tx, rx) = multiqueue::mpmc_queue(MESSAGES as u64);

    crossbeam::scope(|s| {
        for _ in 0..THREADS {
            let tx = tx.clone();
            s.spawn(move || {
                for _ in 0..MESSAGES / THREADS {
                    while tx.try_send(()).is_err() {}
                }
            });
        }
        for _ in 0..THREADS {
            let rx = rx.clone();
            s.spawn(move || {
                for _ in 0..MESSAGES / THREADS {
                    rx.recv().unwrap();
                }
            });
        }
    });
}
@schets
Copy link
Owner

schets commented Oct 25, 2017

thanks, pulling this out of hibernation so will look at it. Fixing some bugs I never got around to and that may reveal the cause of this

@jonathanstrong
Copy link

hey - was wondering: did you ever make headway on this? just ran it with the current version and encountered a deadlock. I spent a few minutes trying to discern what was happening but couldn't make heads or tails of it. Even if it can't be fixed immediately, it'd be nice to know what part of the code triggered the condition, if known. Thanks!

@schets
Copy link
Owner

schets commented Mar 2, 2018

There is at least one bug with the current implementation, I'm working out a whether this directly competes with my current job before I do any future work though

@rivertam
Copy link

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

No branches or pull requests

3 participants