-
Notifications
You must be signed in to change notification settings - Fork 34
test(e2e): reproduce constrained dev shm failure #522
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
Draft
wan9chi
wants to merge
4
commits into
fspy-shm-lifecycle
Choose a base branch
from
constrained-dev-shm-e2e
base: fspy-shm-lifecycle
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
f568748
test(e2e): reproduce constrained dev shm failure
wan9chi 0c7031d
docs(fspy): record shared memory backend requirements
wan9chi 3ea949c
docs(fspy): keep platform rationale with backends
wan9chi 8dac1e8
docs(fspy): record Linux backend requirements
wan9chi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| # Linux backend requirements | ||
|
|
||
| At this point in the stack, Linux still uses the `shared_memory` crate's POSIX | ||
| `shm_open` backend. The constrained `/dev/shm` test records why that backend | ||
| must be replaced for fspy. | ||
|
|
||
| ## Reproduced constraint | ||
|
|
||
| Linux normally backs POSIX shared-memory objects with the `/dev/shm` tmpfs | ||
| mount. Containers often give that mount a small limit independent of the | ||
| host's available memory. A mapping can be created successfully and later fault | ||
| with `SIGBUS` when a write needs a page that the mount cannot supply. | ||
|
|
||
| The | ||
| [`constrained_dev_shm`](../../../vite_task_bin/tests/e2e_snapshots/fixtures/constrained_dev_shm/) | ||
| fixture mounts a one-page `/dev/shm` and forces file-access tracking to write | ||
| beyond that page. The resulting failure defines the acceptance condition for | ||
| a Linux-specific backend. | ||
|
|
||
| ## Requirements | ||
|
|
||
| The fspy channel reserves a large logical region so intercepted processes can | ||
| append without coordinating a resize. A replacement backend must: | ||
|
|
||
| - avoid the container's `/dev/shm` mount limit, | ||
| - avoid allocating the mapping's full logical size up front, | ||
| - let another process open the mapping from a serialized identifier, | ||
| - support clients that run in preload code before `main`, | ||
| - keep data writes free of per-record syscalls, and | ||
| - preserve already-open views when the owner stops accepting new views. | ||
|
|
||
| ## Candidate designs | ||
|
|
||
| | Option | Constraint | | ||
| | --------------------------------------------------- | --------------------------------------------------------------------------------------------- | | ||
| | Keep POSIX `shm_open` | Retains the `/dev/shm` mount dependency reproduced by the test. | | ||
| | Memory-map a temporary file | Escapes `/dev/shm`, but adds path discovery, cleanup, and possible disk writeback. | | ||
| | Inherit an anonymous descriptor | Avoids a name, but every process must propagate the descriptor to children and across `exec`. | | ||
| | Send records through a socket or pipe | Avoids a large mapping, but adds a syscall to every recorded file access. | | ||
| | Distribute an anonymous descriptor through a broker | Keeps mapped data access syscall-free while using a string address only when opening a view. | | ||
|
|
||
| ## Why `shared_memory` cannot remain on Linux | ||
|
|
||
| The `shared_memory` Unix implementation creates its object with POSIX | ||
| `shm_open`. Its API does not accept an existing anonymous descriptor or expose | ||
| a hook for distributing one, so wrapping it cannot remove the `/dev/shm` | ||
| dependency. | ||
|
|
||
| Fspy exposes only creation, opening, an opaque identifier, and mapped bytes. | ||
| A Linux-specific implementation can satisfy that small contract without | ||
| forking the broader persistence and ownership API in `shared_memory`. |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Linux systems whose libc does not export
statx(for example older glibc targets), this LD_PRELOAD library still exportsstatx, so code that weak-links ordlsymsstatxwill call this shim instead of taking its ownSYS_statxfallback. ReturningENOSYShere changes those traced tasks from a working kernelstatxcall into a failure; please invoke the rawSYS_statxpath (and record the access) whenRTLD_NEXThas nostatxrather than exposing a stub.Useful? React with 👍 / 👎.