Skip to content

Tests fail with stack overflow when in breadth-first mode #590

@ghost

Description

How to reproduce:

Go to Registry::new in registry.rs and unconditionally enable breadth-first mode:

let breadth_first = true;

Then run tests with (you may have to run multiple times):

cargo test iter::test::check_cmp_l

Output:

    Finished dev [unoptimized + debuginfo] target(s) in 0.10s
     Running target/debug/deps/rayon-5dd50bb9f566bf60

running 3 tests
test iter::test::check_cmp_lt_to_seq ... ok
test iter::test::check_cmp_lt_direct ... ok

thread '<unknown>' has overflowed its stack
fatal runtime error: stack overflow
error: process didn't exit successfully: `/home/stjepan/work/rayon/target/debug/deps/rayon-5dd50bb9f566bf60 'iter::test::check_cmp_l'` (signal: 6, SIGABRT: process abort signal)

I was first worried that there's a bug in crossbeam-deque. After all, Deque::steal has a custom, optimized version of steal. But if I change calls to Deque::steal with good old Stealer::steal (which should be correct!), the bug is still present:

#[inline]
pub unsafe fn take_local_job(&self) -> Option<JobRef> {
    loop {
        match self.worker.stealer().steal() {
            Steal::Empty => return None,
            Steal::Data(d) => return Some(d),
            Steal::Retry => {},
        }
    }
}

This makes me believe that the bug is actually in Rayon.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions