You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Fix race in MPSC algo
Relacy helped identify a race in the existing MPSC algo. I am having a
hard time exactly explaining what's going on, but in the newly added
unit test (the non Relacy one), I am able to observe three different
odd behaviors
- a consumer consuming the same elemment in an finite loop, apparently
due to the internal next pointers pointing in some sort of cycle
- consumer returning &__nil_!
- consumer never able to consume a produced value (node is lost)
With the non-relacy unit test, in the existing algo, if I insert a
random sleep of 0-10 microseconds in push_back after __back_ is
exchanged, I can observe one of the above behaviors nearly every
single time. The most common was the first behavior.
The existing algo claims it came from Dmitry Vyukov's implementation,
though one key difference is that the existing one uses an atomic
pointer to a Node for the "nil" object, whereas Dmitry's stores an
actual Node object embedded in the queue.
I re-implemented the version in stdexec exactly as it appears on
Dmitry's website (which I had to dig up on archive.org), and it passes
newly added Relacy (exploring many thread interleavings) and non-Relacy
unit tests.
I originally tracked down a bug in timed_thread_scheduler.cpp, where
sometimes `STDEXEC_ASSERT(op->command_ == command_type::command_type::stop);`
failed.
* Add Relacy tests to the build
* Default relacy only fofr GNU
* Remove old Relacy Makefile
* Simplify tests
* Improve implementation to be near to Dmitry's
* Final fixups
- Use STDEXEC::__std::atomic
- Update compiler requirements for Relacy
- Compile Relacy with TBB off
---------
Co-authored-by: Maikel Nadolski <maikel.nadolski@gmail.com>
Co-authored-by: Eric Niebler <eniebler@nvidia.com>
0 commit comments