-
Notifications
You must be signed in to change notification settings - Fork 27
Description
(Known about this for a while but forgot to raise an issue. Trying to be better about bug tracking...)
Our implementation of path compression in the hierarchical heap union-find tree is not safe for concurrency. See Concurrent Disjoint Set Union by Jayanti and Tarjan for discussion of correct implementations. It shouldn't be too difficult to update our code by directly implementing their algorithm.
Our (buggy) implementation is here. To understand what's going on, I recommend reading this (a rare case of actual MaPLe documentation!)
One might wonder why this bug isn't causing terrible things to happen. My intuition: (1) for the most part, the union-find heap representative structures in MaPLe are almost always fully compressed, and (2) concurrent heap queries within the same heap are fairly rare. On the first part, note that (for example) at every LGC when new heaps are constructed, the fresh heaps are initialized with compressed paths. It might be helpful to get a better grasp on this with actual measurements. Perhaps we could contrive a stress test that actually triggers the bug.