Dat3M icon indicating copy to clipboard operation
Dat3M copied to clipboard

The CAAT Solver is not thread-safe

Open xeren opened this issue 3 years ago • 1 comments

The following static fields are modified regularly and exhibit race conditions:

  • solvers.caat.constraints.AcyclicityConstraint.SET_COLLECTION_POOL
  • solvers.caat.constraints.AcyclicityConstraint.TEMP_LIST
  • solvers.caat.misc.PathAlgorithm.queue1 and queue2
  • solvers.caat.misc.PathAlgorithm.parentMap1 and parentMap2

I recommend wrapping them with ThreadLocal.

xeren avatar Oct 21 '22 15:10 xeren

Sure, that can be done. There are also two alternatives IIRC:

  • Make them non-static, but it is not clear where to put those and how to pass them around properly.
  • Just inline them as local variables into the functions that use them. All these variables only serve as temporarily reusable containers that "memorize" typical size requirements. There is likely not much performance degradation in making these local and reconstructing the data structure each time. For initial testing of multi-threaded CAAT, this should be fine.

ThomasHaas avatar Oct 21 '22 23:10 ThomasHaas