Place POSIX shadow files in /tmp on QNX, not the cwd - #112
Merged
Conversation
Channel::BufferSharedMemoryName only special-cased __APPLE__ for the /tmp shadow file path; other POSIX-mode platforms (notably QNX) fell through to the generic branch and returned a bare relative name. That created subspace_<session>_<channel>_<index> shadow files in the process's current working directory instead of /tmp, and made the server's cleanup miss them (leaking the underlying shm object) whenever the server and publishers ran from different directories. Key the /tmp path on SUBSPACE_SHMEM_MODE_POSIX so both macOS and QNX use it, and leave the Linux /dev/shm object-name path untouched.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On QNX,
subspace_<sessionid>_<channel>_<index>files were being created in the current working directory of whatever process created a buffer, rather than in/tmp.These are the POSIX-mode shadow files: in
SUBSPACE_SHMEM_MODE_POSIX(macOS and QNX) the shared memory object is named/sized via a small on-disk file (its length records the buffer's true size, sincefstaton the shm object is page-aligned, and its inode names the shm object — seePosixSharedMemoryName).The bug was in
Channel::BufferSharedMemoryName: it only special-cased__APPLE__for the/tmp/prefix. QNX (also POSIX mode) fell through to the generic branch and returned a bare relative name, so:/tmp./tmp, missed these files and leaked the underlying shm object whenever the server and publishers ran from different working directories.Fix
Key the
/tmp/shadow-file path onSUBSPACE_SHMEM_MODE == SUBSPACE_SHMEM_MODE_POSIXso it applies to both macOS and QNX. The Linux/dev/shmpath is anshm_openobject name (not a filesystem path) and is left untouched.Test plan
bazelisk test //... --config=macos_arm64(POSIX mode) — all pass; macOS shadow-file path unchanged (still/tmp)./tmpand are cleaned up on channel/session teardown.