Skip to content

Fix LMDB sandbox EPERM on macOS#5036

Merged
pwojcikdev merged 1 commit intonanocurrency:developfrom
pwojcikdev:macos-sandbox
Feb 25, 2026
Merged

Fix LMDB sandbox EPERM on macOS#5036
pwojcikdev merged 1 commit intonanocurrency:developfrom
pwojcikdev:macos-sandbox

Conversation

@pwojcikdev
Copy link
Copy Markdown
Contributor

macOS Seatbelt sandbox blocks SysV semaphores used by LMDB, causing mdb_env_open() to fail with EPERM. Use POSIX semaphores (MDB_USE_POSIX_SEM=1) instead. Only for Apple debug builds.

Use POSIX semaphores instead of SysV on Apple debug
builds to avoid Seatbelt blocking mdb_env_open()
@gr0vity-dev-bot
Copy link
Copy Markdown

Test Results for Commit dbb1fcf

Pull Request 5036: Results
Overall Status:

Test Case Results

  • 5n4pr_conf_10k_bintree: PASS (Duration: 127s)
  • 5n4pr_conf_10k_change: PASS (Duration: 198s)
  • 5n4pr_conf_change_dependant: PASS (Duration: 142s)
  • 5n4pr_conf_change_independant: PASS (Duration: 134s)
  • 5n4pr_conf_send_dependant: PASS (Duration: 130s)
  • 5n4pr_conf_send_independant: PASS (Duration: 125s)
  • 5n4pr_rocks_10k_bintree: PASS (Duration: 122s)
  • 5n4pr_rocks_10k_change: FAIL (Duration: 280s)
  • Log

Last updated: 2026-02-24 19:33:34 UTC

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses an issue where LMDB fails to open on macOS due to the Seatbelt sandbox blocking SysV semaphores, causing mdb_env_open() to return EPERM errors. The fix enables POSIX semaphores instead by setting the MDB_USE_POSIX_SEM=1 compile definition for the LMDB library.

Changes:

  • Added configuration to use POSIX semaphores for LMDB on macOS Debug builds to avoid Seatbelt sandbox restrictions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


# LMDB defaults to SysV semaphores on macOS, which are blocked by Seatbelt
# sandbox Use POSIX semaphores instead to avoid EPERM from mdb_env_open()
if(APPLE AND CMAKE_BUILD_TYPE STREQUAL "Debug")
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix is only applied to Debug builds, but macOS Seatbelt sandbox restrictions that block SysV semaphores apply to all build types (Debug, Release, RelWithDebInfo, etc.). This means Release builds on macOS will still experience EPERM errors when calling mdb_env_open(). The condition should be changed to apply to all APPLE builds, not just Debug builds. Consider changing the condition to: if(APPLE)

Suggested change
if(APPLE AND CMAKE_BUILD_TYPE STREQUAL "Debug")
if(APPLE)

Copilot uses AI. Check for mistakes.
endif()

# LMDB defaults to SysV semaphores on macOS, which are blocked by Seatbelt
# sandbox Use POSIX semaphores instead to avoid EPERM from mdb_env_open()
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing period at the end of the first sentence. The comment should read: "# sandbox." instead of "# sandbox Use"

Suggested change
# sandbox Use POSIX semaphores instead to avoid EPERM from mdb_env_open()
# sandbox. Use POSIX semaphores instead to avoid EPERM from mdb_env_open()

Copilot uses AI. Check for mistakes.
@pwojcikdev pwojcikdev merged commit 39571e5 into nanocurrency:develop Feb 25, 2026
31 of 32 checks passed
@pwojcikdev pwojcikdev deleted the macos-sandbox branch February 25, 2026 01:27
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

Successfully merging this pull request may close these issues.

3 participants