feat: Add server option "--allow-client-shm" (default false) controling client shared memory register/unregister - #8721
Conversation
whoisj
left a comment
There was a problem hiding this comment.
Looks good to me. Just have 1 ask before approval.
… yinggeh/tri-32-lock-down-shared-memory-to-avoid-future-psirt-issues-in
whoisj
left a comment
There was a problem hiding this comment.
Look good. Only ask is to correct the markdown to use the more modern markdown for alerts.
Also, a thought about using a constant in place of repeated literals.
…oid-future-psirt-issues-in
There was a problem hiding this comment.
Pull request overview
Adds a new server CLI switch (--allow-client-shm=<bool>, default false) to explicitly control whether clients may register/unregister shared-memory regions, while keeping shared-memory status queries available and leaving backend-internal shared memory unaffected.
Changes:
- Adds
--allow-client-shmparsing/plumbing and passes the value intoSharedMemoryManager. - Rejects HTTP + gRPC shared-memory register/unregister calls when client SHM is disabled (default).
- Updates docs and QA to cover the new default behavior and to enable SHM explicitly for SHM-dependent tests.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/shared_memory_manager.h | Adds constructor parameter + accessor for client-SHM enablement. |
| src/main.cc | Instantiates SharedMemoryManager with the parsed CLI flag. |
| src/http_server.cc | Blocks SHM register/unregister endpoints when client SHM is disabled. |
| src/grpc/grpc_server.cc | Blocks SHM register/unregister RPCs when client SHM is disabled. |
| src/common.h | Introduces a shared error string for the disabled-client-SHM case. |
| src/command_line_parser.h | Adds allow_client_shm_ to server parameters + option grouping storage. |
| src/command_line_parser.cc | Adds CLI option definition/group and parses --allow-client-shm. |
| qa/L0_shared_memory/test.sh | Adds coverage for default-disabled behavior; enables SHM for existing tests. |
| qa/L0_shared_memory/shared_memory_test.py | Adds test asserting register/unregister are rejected by default. |
| qa/L0_cuda_shared_memory/test.sh | Adds coverage for default-disabled behavior; enables SHM for existing tests. |
| qa/L0_cuda_shared_memory/cuda_shared_memory_test.py | Adds test asserting CUDA SHM register/unregister are rejected by default. |
| qa/L0_sequence_batcher/test.sh | Enables --allow-client-shm=true when SHM-related subtests run. |
| qa/L0_infer/test.sh | Enables --allow-client-shm=true when SHM-related subtests run. |
| qa/L0_batcher/test.sh | Enables --allow-client-shm=true for CUDA-SHM tests; adjusts warmup + fixes typo. |
| docs/protocol/extension_shared_memory.md | Documents the new default-disabled requirement for client SHM usage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…psirt-issues-in' of github.com:triton-inference-server/server into yinggeh/tri-32-lock-down-shared-memory-to-avoid-future-psirt-issues-in
… yinggeh/tri-32-lock-down-shared-memory-to-avoid-future-psirt-issues-in
This reverts commit bbb1950.
…y with "--allow-client-shm=true" (#8721)
What does the PR do?
Introduces server option "--allow-client-shm=" (default false) to control client shm registration explicitly.
For example, if
--allow-client-shm=falseor unset (default)✅ GET v2/systemsharedmemory[/region/${REGION_NAME}]/status
❌ POST v2/systemsharedmemory/region/${REGION_NAME}/register
❌ POST v2/systemsharedmemory[/region/${REGION_NAME}]/unregister
✅ GET v2/cudasharedmemory[/region/${REGION_NAME}]/status
❌ POST v2/cudasharedmemory/region/${REGION_NAME}/register
❌ POST v2/cudasharedmemory[/region/${REGION_NAME}]/unregister
if
--allow-client-shm=true✅ GET v2/systemsharedmemory[/region/${REGION_NAME}]/status
✅ POST v2/systemsharedmemory/region/${REGION_NAME}/register
✅ POST v2/systemsharedmemory[/region/${REGION_NAME}]/unregister
✅ GET v2/cudasharedmemory[/region/${REGION_NAME}]/status
✅ POST v2/cudasharedmemory/region/${REGION_NAME}/register
✅ POST v2/cudasharedmemory[/region/${REGION_NAME}]/unregister
Checklist
<commit_type>: <Title>Commit Type:
Check the conventional commit type
box here and add the label to the github PR.
Related PRs:
Where should the reviewer start?
Test plan:
48256373
Caveats:
Background
Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)