
On 1/28/25 15:16, Murali Kishore via Boost wrote:
Thanks Peter Dimov, i have added logic unlock in signal handler, now i am not seeing this issue.
I am seeing one more issue, if i call construct object and do work and clear in loop of ~30000, i see following error while construct call.
It's not enough to just unlock the mutex (or recover it if it was abandoned). You also need to restore the state it was protecting to a consistent state. Which is often unrealistic to do since you don't know which part of the state is corrupted and how to restore it to a consistent state. For example, you don't have the means to repair the segment manager, if its internal object tree is left corrupted, and you don't know whether any of the objects stored in it are half-constructed or otherwise inconsistent. Typically, your best course of action when you detect an abandoned mutex is to scrap the data it protects and start from scratch. And also try hard to not abandon mutexes as much as possible, e.g. don't just kill the process on a signal and let it finish its work on the shared memory first.