POETSII / Orchestrator

The Orchestrator is the configuration and run-time management system for POETS platforms.
1 stars 1 forks source link

Add pthread mutex to protect SuperDB::supervisors map from thread-unsafe modification. #299

Closed mvousden closed 2 years ago

mvousden commented 2 years ago

Resolves #290.

The intermittent segmentation fault reported in #290 was a Mothership segmentation fault, which occured when a supervisor was deleted from the supervisor map, and the iterator SuperDB::nextIdle was incremented simultaneously. A pthread mutex SuperDB::mapLock has been added to prevent this.

GCC's various instrumentation flags have been instrumental in diagnosing this issue, as the segmentation fault never triggered in debug mode, or when run under Valgrind. As such, a set of generally-useful instrumentation flags have been added to the debug build. These can be added to the performance build when needed, though this is not the default as they incur a (admittedly miniscule) performance penalty.

The segmentation fault did not occur, after implementing this change, running the same example repeatedly on Ayres for six hours.