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

Deadlock in tbb::concurrent_vector when resizing + growing. #733

Closed
jdumas opened this issue Jan 16, 2022 · 2 comments · Fixed by #735
Closed

Deadlock in tbb::concurrent_vector when resizing + growing. #733

jdumas opened this issue Jan 16, 2022 · 2 comments · Fixed by #735
Labels

Comments

@jdumas
Copy link

jdumas commented Jan 16, 2022

Hi. We've encountered a scary bug with TBB on the following code snippet:

tbb::concurrent_vector<int> v;
v.resize(382);
while (v.size() < 737) {
    v.emplace_back();
}
v.resize(27);
while (v.size() < 40) {
    v.emplace_back();
}

The problem is that the emplace_back() goes into an infinite loop at this line:
https://github.com/oneapi-src/oneTBB/blob/ec39c5463d5fbfe01150bcd8cbfe60b5e064d693/include/oneapi/tbb/concurrent_vector.h#L575

This happens with both oneTBB 2021.4.0 and 2021.5.0. The problem can be reproduced on godbolt:
https://godbolt.org/z/rsed7sYP7

I can reproduce the issue on both clang, gcc and msvc.

@pavelkumbrasev
Copy link
Contributor

I can reproduce it. At a first glance, it looks like a bug in a segment table of concurrent_vector.

@pavelkumbrasev pavelkumbrasev linked a pull request Jan 17, 2022 that will close this issue
14 tasks
@pavelkumbrasev
Copy link
Contributor

pavelkumbrasev commented Jan 20, 2022

@jdumas Could you please recheck your case with current master? And if it fails, please reopen the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants