Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2025-01-23 18:05:10


Murali Kishore wrote:
> Hi ,
>
> We are trying interprocess scenario, one process created shared memory
> objects and killed and second process open the object using find_or_construct
> seeing this process blocked at getting lock.
>
> bt as shown below,
> #0 __lll_lock_wait () at
> ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:135
> #1 0x00007fa6b6733eb6 in _L_lock_941 () from /lib64/libpthread.so.0
> #2 0x00007fa6b6733daf in __GI___pthread_mutex_lock
> (mutex=mutex_at_entry=0x7fa6b198b070)
> at ../nptl/pthread_mutex_lock.c:113
> #3 0x0000000001bc3822 in lock (this=0x7fa6b198b070) at
> /x86/include/boost/interprocess/sync/posix/recursive_mutex.hpp:90

Detecting mutexes held by dead processes requires the so-called
POSIX robust mutexes. I can see in the Interprocess source code
that those are enabled when the macro
BOOST_INTERPROCESS_POSIX_ROBUST_MUTEXES is defined.

This macro is defined automatically

#if (_XOPEN_SOURCE >= 700 || _POSIX_C_SOURCE >= 200809L)

https://github.com/boostorg/interprocess/blob/29cee9c6067f1d20ddb6421af15977e7bbaa3a18/include/boost/interprocess/detail/workaround.hpp#L81-L83

but I suppose you can also try defining it manually and see if that helps,
because _XOPEN_SOURCE and _POSIX_C_SOURCE are also user macros
and you probably aren't defining any of them.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk