-
Notifications
You must be signed in to change notification settings - Fork 21
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
The MPSC channel has a deadlock #6
Comments
Is this deadlock reproducible with the C version? |
No it's only my own channel reimplementation. When I switched to the 1-to-1 reimplementation of your Nim channels (04c355d) it disappeared. |
So I manage to get it again while changing the implementation of the MPSC queue to yet another one lock-free queue (suitable for batching for my memory manager) The main difference is that it uses compare-and-swap which are more heavy on cache lines so maybe behave worse under contention. Steal backoff might help here It's probably a livelock and not a deadlock, it may be unrelated but it's very annoying nonetheless. It happens reliably even on just a hello world Lines 138 to 151 in e3a1f29
The main thread always get stucks in this loop in the runtime barrier Lines 124 to 138 in 9f4abc4
adding some printing in declining or the steal request relay (or uncommenting the debugTermination log) will unstuck the runtime for a 20% perf loss :P. Lines 79 to 89 in 9f4abc4
Lines 96 to 108 in 9f4abc4
|
False alarm, it's my queue that has an issue, I can reproduce the bug in an isolated bench. I think I have an ABA problem with the producers' side using exchange and the consumer side using compare-exchange. |
The MPSC channel for StealRequest has a deadlock
Reproducible with 5 workers on Fibonacci.
Also it might be worth it to move to a lock-free design even though the lock-based design is not a bottleneck.
The text was updated successfully, but these errors were encountered: