boostorg / interprocess

Boost.org interprocess module
http://boost.org/libs/interprocess
132 stars 117 forks source link

check_sanity() scoped mutex locked after assertion #177

Closed lioriz closed 2 years ago

lioriz commented 2 years ago

In check_sanity() function, In the scenario where multiple processes share the same shared memory, if the shared memory is corrupted for some reason then when one of the processes calls check_sanity() the scoped mutex in the function locks but the process crashes with assertion without unlocking the mutex, causing any other process that will call check_sanity() to be stuck on the locked scoped mutex.

If there is a mutex in a shared memory object it must be unlocked before assertion, exception, or return. I would expect the check_sanity() function to return false in the case of corrupted memory instead of assert.

lioriz commented 2 years ago

opened PR 178 for this issue.

igaztanaga commented 2 years ago

Many thanks for the PR!

lioriz commented 2 years ago

Many thanks for the PR!

My pleasure.