Skip to content

boost::named_mutex remains acquired after crash #56

Closed as duplicate

Description

@skryv-softserveinc

tried on macOS

Activity

  1. 363568233 commented on Dec 17, 2018

    @363568233

    It exists on any OS. Because the default named_mutex is spin_wait, you can view the source code, there is macro to change internal implementation. You can change it to posix pthread_mutex on macOS, now it update to robust mutex, maybe you need to update the source code.

  2. 363568233 commented on Dec 17, 2018

    @363568233

    Changed the posix mutex implementation to be robust #66

  3. 363568233 commented on Dec 17, 2018

    @363568233

    #if defined(BOOST_INTERPROCESS_USE_POSIX_SEMAPHORES)
    typedef ipcdetail::posix_named_mutex internal_mutex_type;
    #undef BOOST_INTERPROCESS_USE_POSIX_SEMAPHORES
    #elif defined(BOOST_INTERPROCESS_USE_WINDOWS)
    typedef ipcdetail::windows_named_mutex internal_mutex_type;
    #undef BOOST_INTERPROCESS_USE_WINDOWS
    #else
    typedef ipcdetail::shm_named_mutex internal_mutex_type;
    #endif
    But define BOOST_INTERPROCESS_USE_POSIX_SEMAPHORES, boost using the posix semaphore, deadlock are also possible. You should use posix_mutex shared in process, but named_mutex dont't use posix_mutex. I did it myself...

  4. seanlis commented on Oct 31, 2020

    @seanlis

    Would this issue ever get fixed? It has been there for almost a decade.
    I spent one whole day to add named_mutex and named_condition to my windows apps, and then found out this issue forcing me to look for other solutions.

  5. Dalzhim commented on Nov 11, 2022

    @Dalzhim

    I'm also wondering why the PR #66 was closed without ever being merged. Running into this problem is quite annoying when a known solution has existed for so long!

  6. igaztanaga commented on Jan 7, 2026

    @igaztanaga
    Member

    In MacOS, there is no operating system support for robust mutexes in shared memory. In systems with support for robust mutexes in shared memory (e.g. linux), the library already uses this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions