Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interprocess anonymous mutex hangs with Apple Silicon #176

Open
r0ck3r008 opened this issue Jun 6, 2022 · 2 comments
Open

Interprocess anonymous mutex hangs with Apple Silicon #176

r0ck3r008 opened this issue Jun 6, 2022 · 2 comments

Comments

@r0ck3r008
Copy link

r0ck3r008 commented Jun 6, 2022

Hi, boost interprocess anonymous mutex seems not to be handling well in ARM64 of Apple Silicon.

#include <iostream>
#include <boost/interprocess/managed_shared_memory.hpp>
#include <boost/interprocess/sync/interprocess_mutex.hpp>

using namespace boost::interprocess;

int main() {
    try{
        managed_shared_memory managed_shm{open_or_create, "shm", 1024};
        interprocess_mutex *mtx =
            managed_shm.find_or_construct<interprocess_mutex>("mtx")();

        mtx->lock();
        std::cout << "Critial section" << std::endl;
        mtx->unlock();
    } catch (const boost::interprocess::interprocess_exception &e) {
        std::cerr << "Interprocess exception thrown: " << e.what() << std::endl;
        _exit(1);
    }
}

Compilation steps followed

clang++ -std=c++17 -arch arm64 boost_interprocess.cpp -I<BOOST_HOME> -o boost_interprocess_arm64 # For arm64 only build
clang++ -std=c++17 -arch x86_64 boost_interprocess.cpp -I<BOOST_HOME> -o boost_interprocess_x64 # For x64 only build 

Expected Behavior
Both the instantiations should work and print Critical Section.

What was observed
When arm64 build is executed first, it works fine, but when x64 build is executed, the subsequent arm64 execution hangs.

Steps to reproduce

  • rm /tmp/boost_interprocess/shm
  • ./boost_interprocess_x64
  • ./boost_interprocess_arm64

Environment tested on

  • MacBook Air (M1, 2020)
  • MacOS Monterey 12.3.1
  • Apple clang version 13.1.6 (clang-1316.0.21.2.5)
@igaztanaga
Copy link
Member

I don't have access to a Mac, so I would need some debugging and help from your side.

@r0ck3r008
Copy link
Author

@igaztanaga sure let me know how I can help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants