[Bugfix] Give SHM connector lock files a segment-derived lifecycle (#7636 Issue 24) #7840
This PR appears to belong to: docs/design/module/omni_connector.md, docs/design/module/input_output_modality_contracts.md, docs/design/module/diffusion/parallelism.md.
Module owners: @princepride @fake0fan @natureofnature
Routing: @princepride via module of the changed files, module named in the PR description, CODEOWNERS; @fake0fan via module of the changed files, module named in the PR description; @natureofnature via module of the changed files, module named in the PR description
@yanbao1217, please review your own changes and leave a short self-review comment describing what you checked. PRs without author self-review may not be assigned a reviewer.
Please take a look when you have a chance. If you would like an automated review, mention @vllm-omni-review-bot in a comment.
<!-- omni-reviewbot:assignment:v1 repo=vllm-project/vllm-omni pr=7840 -->
Omni ReviewBot triage note
Automated triage of commit e2ae09ffd2a7 produced:
These are automated triage suggestions only — the final decision belongs to the maintainers.
<!-- omni-reviewbot:quality-note:v1 repo=vllm-project/vllm-omni pr=7840 -->
<!-- omni-reviewbot:quality-note-head:e2ae09ffd2a7d6dbbb73e12e8d09966e5a010459 -->
<!-- omni-reviewbot:quality-note-state:live -->
Self-review:
SharedMemoryConnector. The new removal paths for failed put(), failed reads after segment loss, and startup sweeping preserve the rule that an orphan lock is reclaimable only after its backing segment is gone; existing cleanup(), close(), and _pending_keys behavior is unchanged.open() -> flock() window, actively held locks, live segments, unrelated filenames, and foreign-uid files are all skipped. Per-file syscall failures are contained and do not abort the sweep.test_shm_connector.py, and 379 passed / 1 environment-dependent skip in tests/distributed/omni_connectors under core_model and cpu. /dev/shm has no lockfile residue after the suite.main and this branch: failed put(), deserialize failure after read, sender SIGKILL, clean exit without close(), and partial multi-chunk consumption. The leaks reproduce on main and are cleaned on this branch.ruff, mypy==1.11.1, and forbidden-import checks pass. I found no additional correctness issue beyond the residual races already documented in the PR description.Out of scope for this PR: we are implementing file lock manually using fcntl in multiple places, these should be replaced with the filelock library.
Thanks for taking a look! Happy to track the migration in a separate issue if that helps.
Omni ReviewBot: no human activity for 7 days
@yanbao1217 this pull request has had no human commit, comment or review since 2026-09-24. Please confirm the current plan and next step. The author or a maintainer decides whether to change the PR state.
To keep it moving, any one of these is enough: push an update, reply to the open blocker, or post the current plan and timeline.
<!-- omni-reviewbot:stale:v1 repo=vllm-project/vllm-omni pr=7840 window=2026-09-24T01:45:00+00:00 -->
<!-- omni-reviewbot:quality-note-state:live -->
<details>
<summary>Omni ReviewBot routing record</summary>
Assigned Strict on cursor (cursor-grok-4.6-high) under experiment fleet-strict-cursor-grok46-zcode-glm53flash-5050-c5-z10-20261002.
</details>
<!-- omni-reviewbot:mode-assignment:v1
{
"algorithm": "hmac-sha256-bucket-v1",
"assigned_mode": "strict",
"assignment_id": "ma1_db2cf97041e378bcc8e314bfb3a7bab8bc772f4d3b4077049ad86ab7389a1e68",
"backend": "cursor",
"bucket": 513,
"bucket_proof": "01a1f53dc3b17461264333afd7d682077ecee7937c6271b6fd2728075ccebd44",
"experiment_id": "fleet-strict-cursor-grok46-zcode-glm53flash-5050-c5-z10-20261002",
"head_sha_at_assignment": "fc17ff94fb4b275a69af9739cbe28f1882e16990",
"infermatrix_sha_at_assignment": "infermatrix-copilot==0.2.0",
"model": "cursor-grok-4.6-high",
"policy_sha256": "a923e3808fb913b7f34ce67fdf17fb4c5bf810abb19c7dcac2599eb356d1bd6d",
"pr": 7840,
"repo": "vllm-project/vllm-omni",
"repo_id": 1054512829,
"reviewbot_sha": "unknown",
"salt_id": "s3-c5-z10-20261002",
"source": "split",
"trigger_comment_id": null,
"unit": "pull_request"
}
-->
Hi @chickeyton @princepride @NickCao @hsliuustc0106 , following up on this PR for Issue 24 in #7636. I noticed the tracking issue has been closed, while Issue 24 is still listed as “reviewing” and this PR remains open.
Should this SHM lock-file lifecycle fix still proceed independently, or has it been superseded by other cleanup work? If it is still wanted, could you help review it or point me to the appropriate reviewer? I’m happy to resolve the current merge conflicts and rerun the tests. Thanks!
[P0] This PR cannot merge onto current vllm-project:main: GitHub reports mergeable=f…
<details>
<summary>Evidence and suggested fix</summary>
This PR cannot merge onto current vllm-project:main: GitHub reports mergeable=false / mergeable_state=dirty / rebaseable=false (base 51c715c7, head fc17ff94). This tree's SharedMemoryConnector.__init__ calls once-per-process _sweep_stale_lock_files() (shm_connector.py:123-125) and _get_data_with_lock unlinks via deserialized or seg_gone (shm_connector.py:185-186). Live main already replaced this file with wakeup FIFOs (/dev/shm/omni_shm_wake_*), get_with_deadline, _wake_receiver, reap_consumed, cleanup_prefix, LOCK_NB, and OrderedDict _pending_keys; this PR-time tree has zero matches for those symbols. After rebase, port only the still-missing pieces: failed put() lock unlink (main's put() still does meta = shm_write_bytes(...) with no lock-file except) plus dead-segment lock removal and the startup sweep. Do not overlay deserialized or seg_gone on main's get path: it already sets consumed = True immediately after shm_read_bytes and unlinks the lock in finally if consumed. Re-run tests/distributed/omni_connectors/test_shm_connector.py after the port.
Evidence: Trigger: merge/rebase of this head onto current vllm-project:main. Adverse effect: GitHub will not merge, and overlaying this get() lock policy would replace main's already-correct consume-after-read unlink (and drop LOCK_NB/wakeup). PR-time tree shm_connector.py:125 _sweep_stale_lock_files(); shm_connector.py:185-186 seg_gone = not os.path.exists(f"/dev/shm/{shm_handle['name']}") / if deserialized or seg_gone:. Unchanged by this diff, live GitHub GET /repos/vllm-project/vllm-omni/pulls/7840: "mergeable": false, "rebaseable": false, "mergeable_state": "dirty", base sha 51c715c7ef87c23bde02cb274a3741f3d8301857. Unchanged by this diff and absent from the PR-time tree (grep: 0 matches for reap_consumed / get_with_deadline / _wake_receiver / cleanup_prefix): live vllm-project/main shm_connector.py put() still does meta = shm_write_bytes(payload, name=put_key) with no lock-file except; _get_data_with_lock does data_bytes = shm_read_bytes(shm_handle) then consumed = True then finally: if consumed: os.remove(lock_file).
</details>
[P1] Production SHM polling never enters _get_data_with_lock's new reclaim
<details>
<summary>Evidence and suggested fix</summary>
Production SHM polling never enters _get_data_with_lock's new reclaim. chunk_transfer_adapter.py:57-65 sets source_metadata to {source_host, source_port} or None, so get() at shm_connector.py:233-243 takes _get_by_key. After a crashed sender's segment is gone, SharedMemory(name=get_key) raises FileNotFoundError and shm_connector.py:205-206 returns None without touching /dev/shm/shm_{key}_lockfile.lock. The receiver already set _swept_this_process True in __init__, so constructor sweep will not run again and crash leftovers this PR claims to fix keep accumulating on tmpfs. test_get_failure_dead_segment_removes_lock_file hides this by passing metadata=meta from put() ({"shm": ...} at shm_connector.py:154), which takes the metadata path. Reclaim that lock on the FileNotFoundError with the same check–LOCK_NB–recheck protocol (keep the 60s grace so put()'s open→flock window is not stolen), and add a regression get(..., metadata=None) after unlinking the segment.
Evidence: Trigger: a live receiver polls connector.get(..., entry.source_metadata) after the sender's POSIX segment has been reaped; source_metadata has no shm key, so get() never calls _get_data_with_lock. Adverse effect: /dev/shm/shm_{key}_lockfile.lock is left on tmpfs forever on that process because _get_by_key swallows FileNotFoundError and _swept_this_process is already True. shm_connector.py:205-206 except FileNotFoundError: / return None. shm_connector.py:239-243 result = self._get_by_key(get_key) / else: / result = self._get_by_key(get_key). shm_connector.py:122-125 _swept_this_process = True then _sweep_stale_lock_files(). Unchanged by this diff, present in the PR-time tree: chunk_transfer_adapter.py:57-65 self.source_metadata = None then, if host and zmq_port exist, {"source_host": str(host), "source_port": int(port)} (no shm key); chunk_transfer_adapter.py:504-508 result = self.connector.get(..., entry.source_metadata). Test that hides the path: test_shm_connector.py:322 result = connector.get("s0", "s1", key, metadata=meta) with put() metadata shm_connector.py:154 metadata = {"shm": meta, "size": size}.
Suggestion: except FileNotFoundError:
lock_file = f"/dev/shm/shm_{get_key}_lockfile.lock"
try:
_sweep_stale_lock_files() # single-key reclaim is better; reuse grace/LOCK_NB so in-flight put() is not stolen
except OSError:
pass
return None
</details>
[P1] This diff sets _swept_this_process = True before the first _sweep_stale_lock…
<details>
<summary>Evidence and suggested fix</summary>
This diff sets _swept_this_process = True before the first _sweep_stale_lock_files() (shm_connector.py:123-125) and the sweep skips any lock whose mtime is younger than _STALE_LOCK_GRACE_SECONDS (60s; lines 19 and 56). The only production caller is SharedMemoryConnector.__init__; put()/get() never resweep. Default stage wiring is SharedMemoryConnector (unchanged omni_config.py:610), and workers construct it during init_omni_connectors / chunk-adapter init. After an abnormal exit, resource_tracker reaps the segment while the lock file remains; a new process that builds a connector within 60s (the normal restart window) grace-skips those orphans, then never visits them again for the life of that process — the crash-orphan leak this bugfix claims to close still accumulates. A grace that only covers the open()→flock() µs window must not be treated as a completed sweep: gate a resweep on a monotonic timestamp from __init__ and put()/get() (at most once per grace). test_crashed_subprocess_lock_swept_by_new_process cannot fail this contract: it _backdates the lock 120s, then calls _sweep_stale_lock_files in the same interpreter (test_shm_connector.py:472-473). Drive a young orphan through SharedMemoryConnector({}) without _backdate, then construct another connector after grace (or via the put-gated resweep) and assert the lock is gone.
Evidence: Trigger: a new process constructs the default SharedMemoryConnector while crash-orphan lock files are still <60s old. shm_connector.py:19 _STALE_LOCK_GRACE_SECONDS = 60.0 # seconds; young lock files are never touched; shm_connector.py:56 if time.time() - os.stat(path).st_mtime < grace: then continue; shm_connector.py:123-125 if not _swept_this_process: / _swept_this_process = True # set first: the sweep is idempotent anyway / _sweep_stale_lock_files(). Adverse effect: those young orphans are skipped, the process-wide flag is already True so no later __init__/put/get revisits them, and /dev/shm/shm_*_lockfile.lock files accumulate for the worker lifetime — unmet by the class contract shm_connector.py:106-109 Abnormally terminated processes leave lock files behind once their / segments are reaped by `resource_tracker; the first connector / constructed in a new process sweeps such orphans / (_sweep_stale_lock_files).. Unchanged by this diff, present in the PR-time tree: omni_config.py:610 "name": "SharedMemoryConnector",; omni_connector_runtime.py:156-157 self._omni_connector: OmniConnectorBase | None = ( / self._create_connector(model_config) if _should_create_payload_connector(model_config) else None. The added test cannot fail this: test_shm_connector.py:472 self._backdate(lock) # the restart happens some time after the crash then line 473 shm_conn_module._sweep_stale_lock_files(grace=60.0).
Suggestion: _maybe_sweep_stale_lock_files()
</details>
Omni ReviewBot review
4 actionable finding(s).
CI atfc17ff94fb4b(2026-10-10T04:52:55.679006+00:00): required check(s) blocking:buildkite/vllm-omni(missing).
<details>
<summary>Full review analysis</summary>
Scan:
| Category | Result |
|---|---|
| Tests / verification | 3 finding(s) below |
| Security | no finding reported |
| Docs / comments | 1 finding(s) below |
| Behavior / compatibility | no finding reported |
| Correctness | no finding reported |
Validated:
4 actionable finding(s).
Verdict: REQUEST CHANGES
</details>
Findings
docs/design/feature/omni_connectors/shared_memory_connector.md<details>
<summary>Evidence for This PR changes the lock-file lifecycle in shm_connector.py (failed put unlinks…</summary>
This PR changes the lock-file lifecycle in shm_connector.py (failed put unlinks the lock; get unlinks only when deserialized or seg_gone; once-per-process _sweep_stale_lock_files) and documents that in the class docstring (shm_connector.py:100-110), but does not edit the indexed feature page. Unchanged shared_memory_connector.md:146 still lists get() step 5 as Remove the lock file if it still exists, and §5.1 put() still ends at write/return with no failure unlink. Update §4.3 / §5.1 / §5.2 to the new lifecycle so the published feature contract matches the implementation.
Evidence: Trigger: this PR changes the SHM lock-file contract and the class docstring, but the feature design page is not in the diff. Unmet requirement: an active feature page whose put/get/locking contract changed must be updated in the same PR (design-contracts.md:30-31 When behavior changes an active module or feature contract, require the same PR to update that page.). Unchanged by this diff, present in the PR-time tree: docs/design/feature/omni_connectors/shared_memory_connector.md:146 5. Remove the lock file if it still exists. and :126-128 3. Acquire the per-request lock file. / 4. Write the bytes into shared memory. / 5. Return lightweight metadata to the caller. New contract in the diff: shm_connector.py:143-147 except BaseException: then os.remove(lock_file) and shm_connector.py:185-186 seg_gone = not os.path.exists(f"/dev/shm/{shm_handle['name']}") / if deserialized or seg_gone:. Adverse effect: readers of §5.1/§5.2 still see success-path-only lock handling (always remove after get; no failed-put unlink, keep-while-segment-lives, or orphan sweep), so the published feature contract no longer matches the implementation.
Suggestion: 5. Remove the lock file when the segment is gone (successful read, failed read after unlink, or failed put); keep it while the segment still exists so the transfer can be retried. Orphans left after the owner dies are removed by a once-per-process startup sweep.
</details>
---
<sub>🤖 This review was generated by InferMatrix Copilot, an open-source repo-maintenance agent for PR review, CI debugging and issue triage. Try it on your own repo, and ⭐ star it if it helped!</sub>
<!-- omni-reviewbot:v1 repo=vllm-project/vllm-omni pr=7840 head=fc17ff94fb4b275a69af9739cbe28f1882e16990 -->
<!-- omni-reviewbot:mode-result:v1
{
"assigned_mode": "strict",
"assignment_id": "ma1_db2cf97041e378bcc8e314bfb3a7bab8bc772f4d3b4077049ad86ab7389a1e68",
"attempt_id": "6f604ff5ac018e890e28e4657efa86ac1396ee6259115de9a11d2202fd6475c1",
"backend": "cursor",
"duration_ms": 1994500,
"executed_mode": "strict",
"experiment_id": "fleet-strict-cursor-grok46-zcode-glm53flash-5050-c5-z10-20261002",
"fallback_reason": "auto-review: nightly sweep runs the PR's routing-table arm; excluded from the arm analysis",
"infermatrix_sha": "infermatrix-copilot==0.2.0",
"model": "cursor-grok-4.6-high",
"review_depth": "standard",
"reviewbot_sha": "unknown",
"reviewed_head_sha": "fc17ff94fb4b275a69af9739cbe28f1882e16990",
"terminal_state": "completed"
}
-->
Omni ReviewBot: finding feedback
[p1] Production SHM polling never enters _get_data_with_lock's new reclaim — vllm_omni/distributed/omni_connectors/connectors/shm_connector.py:185
See the review for details. If you are the PR author and disagree, react 👎 here; the maintainer will see your disagreement.
<!-- omni-reviewbot:finding-feedback:v1 repo=vllm-project/vllm-omni pr=7840 finding=02b712729b48fe72 -->
Omni ReviewBot: finding feedback
[p0] This PR cannot merge onto current vllm-project:main: GitHub reports mergeable=f… — vllm_omni/distributed/omni_connectors/connectors/shm_connector.py:125
See the review for details. If you are the PR author and disagree, react 👎 here; the maintainer will see your disagreement.
<!-- omni-reviewbot:finding-feedback:v1 repo=vllm-project/vllm-omni pr=7840 finding=0c9bca2a479b4969 -->
Omni ReviewBot: finding feedback
[p1] This diff sets _swept_this_process = True before the first _sweep_stale_lock… — vllm_omni/distributed/omni_connectors/connectors/shm_connector.py:124`
See the review for details. If you are the PR author and disagree, react 👎 here; the maintainer will see your disagreement.
<!-- omni-reviewbot:finding-feedback:v1 repo=vllm-project/vllm-omni pr=7840 finding=f88c3511b7db3003 -->
Thanks for the thorough review — all four findings are addressed in fb41bce23
(reworked onto the wakeup-FIFO connector, mergeable again):
reduced to extending the existing
consumed unlink with or seg_gone — main'sconsume-after-read semantics are untouched, as the finding suggested.
_get_by_key'sFileNotFoundError branch now calls _reclaim_orphan_lock_file(get_key) — thesame check–LOCK_NB–recheck protocol with the grace window, so an in-flight
put() is never stolen. Added the suggested regression (get(metadata=None)after the segment is gone) plus a young-lock guard test.
_maybe_sweep_stale_lock_files() is gated on a monotonic timestamp checked from__init__/put()/get() (at most one sweep per grace period). Regressionadded: a young orphan is skipped by the first constructor and reclaimed by the
next gated sweep once the grace really elapses (no clock faking — the grace is
shrunk in the test).
shared_memory_connector.md §4.3/§5.1/§5.2/§5.3 updatedto the lifecycle contract.
buildkite/vllm-omni (missing) looks infra-side; nothing in this branch cantrigger it.
Local: 60 passed on the changed file, 470 passed / 1 env skip on
tests/distributed/omni_connectors, zero lockfile residue in /dev/shm.
<details>
<summary>Omni ReviewBot attempt record</summary>
Review attempt ended as failed (failed; retrying strict/cursor/cursor-grok-4.6-high in 120s (try 2 of 3)).
</details>
<!-- omni-reviewbot:mode-result:v1
{
"assigned_mode": "strict",
"assignment_id": "ma1_db2cf97041e378bcc8e314bfb3a7bab8bc772f4d3b4077049ad86ab7389a1e68",
"attempt_id": "234e3346500817054990b941ea3a125486e080076eb1d9da58cd7f956095783c",
"backend": "cursor",
"duration_ms": 242845,
"executed_mode": "strict",
"experiment_id": "fleet-strict-cursor-grok46-zcode-glm53flash-5050-c5-z10-20261002",
"fallback_reason": "auto-review: nightly sweep runs the PR's routing-table arm; excluded from the arm analysis",
"infermatrix_sha": "infermatrix-copilot==0.2.0",
"model": "cursor-grok-4.6-high",
"review_depth": "standard",
"reviewbot_sha": "unknown",
"reviewed_head_sha": null,
"terminal_state": "failed"
}
-->
<details>
<summary>Omni ReviewBot attempt record</summary>
Review attempt ended as failed (failed; retrying strict/cursor/cursor-grok-4.6-high in 600s (try 3 of 3)).
</details>
<!-- omni-reviewbot:mode-result:v1
{
"assigned_mode": "strict",
"assignment_id": "ma1_db2cf97041e378bcc8e314bfb3a7bab8bc772f4d3b4077049ad86ab7389a1e68",
"attempt_id": "f73fb008e5518de4504b410126b4c632f2c477ee860555074fb9140605bd3d43",
"backend": "cursor",
"duration_ms": 93064,
"executed_mode": "strict",
"experiment_id": "fleet-strict-cursor-grok46-zcode-glm53flash-5050-c5-z10-20261002",
"fallback_reason": "auto-review: nightly sweep runs the PR's routing-table arm; excluded from the arm analysis",
"infermatrix_sha": "infermatrix-copilot==0.2.0",
"model": "cursor-grok-4.6-high",
"review_depth": "standard",
"reviewbot_sha": "unknown",
"reviewed_head_sha": null,
"terminal_state": "failed"
}
-->
<details>
<summary>Omni ReviewBot attempt record</summary>
Review attempt ended as failed (failed; falling back to direct/cursor/auto).
</details>
<!-- omni-reviewbot:mode-result:v1
{
"assigned_mode": "strict",
"assignment_id": "ma1_db2cf97041e378bcc8e314bfb3a7bab8bc772f4d3b4077049ad86ab7389a1e68",
"attempt_id": "d131cba04280a5c2de40d3af55a7b7e3143fd48c6ca43ffb90d7c749680a07ef",
"backend": "cursor",
"duration_ms": 108185,
"executed_mode": "strict",
"experiment_id": "fleet-strict-cursor-grok46-zcode-glm53flash-5050-c5-z10-20261002",
"fallback_reason": "auto-review: nightly sweep runs the PR's routing-table arm; excluded from the arm analysis",
"infermatrix_sha": "infermatrix-copilot==0.2.0",
"model": "cursor-grok-4.6-high",
"review_depth": "standard",
"reviewbot_sha": "unknown",
"reviewed_head_sha": null,
"terminal_state": "failed"
}
-->
Omni ReviewBot review
Changes since the previous review
_get_data_with_lock's new reclaim — vllm_omni/distributed/omni_connectors/connectors/shm_connector.pyvllm_omni/distributed/omni_connectors/connectors/shm_connector.pydocs/design/feature/omni_connectors/shared_memory_connector.md_swept_this_process = True before the first _sweep_stale_lock… — vllm_omni/distributed/omni_connectors/connectors/shm_connector.pyCI at fb41bce236c7(2026-10-10T17:39:05.419412+00:00):required check(s) blocking: buildkite/vllm-omni(missing).
Note: The assigned review arm strict/cursor/cursor-grok-4.6-highcould not complete this review, so it was produced by the fallback armdirect/cursor/auto. It is excluded from the routing experiment.
<details>
<summary>Full review analysis</summary>
PR description
SharedMemoryConnector treats each /dev/shm/shm_{key}_lockfile.lock file as tied to its POSIX segment. A failed put() removes the lock while the creator still holds flock; a read whose segment is already gone removes it; a key-based get() that hits FileNotFoundError reclaims that key's orphan after a 60s grace and a non-blocking lock. A process-wide sweep of stale lock files runs at most once per grace interval from __init__, put(), and get(), so a restart that lands inside the grace window can collect young crash leftovers on a later call. cleanup(), close(), and wakeup behavior are unchanged.
Change flow
flowchart TD
Poll["[EXISTING] Stage put and key-based get"]:::existing
Conn["[CHANGED] SharedMemoryConnector lock handling"]:::changed
Reclaim["[NEW] Grace reclaim and time-gated sweep"]:::new
Doc["[CHANGED] shared_memory_connector.md lifecycle"]:::changed
Tests["[NEW] TestLockFileLifecycle"]:::new
Poll --> Conn
Conn --> Reclaim
Reclaim --> Doc
Conn --> Tests
classDef existing fill:#e5e7eb,stroke:#6b7280,color:#111827
classDef changed fill:#fef3c7,stroke:#d97706,color:#451a03,stroke-width:2px
classDef new fill:#dcfce7,stroke:#16a34a,color:#052e16,stroke-width:2px
classDef removed fill:#fee2e2,stroke:#dc2626,color:#450a0a,stroke-width:2px
</details>
Findings
<details>
<summary>Evidence for Feature page still says cleanup and close are no-ops</summary>
The new lifecycle paragraph (shared_memory_connector.md:118) says lock files are removed by cleanup() / close() for keys in _pending_keys. On the same page, §6.2 still says cleanup() is a no-op (line 172) and §6.3 says close() is a no-op that does not recover leaked segments (line 181). At this head, cleanup() unlinks the segment and the lock (shm_connector.py:459-484) and close() runs that for every tracked key, then _close_wakeups()` (lines 497-503). Readers of §6 will follow the opposite contract from §4.3. Update §6.2 and §6.3 to the tracked-key unlink behavior.
</details>
---
<sub>🤖 This review was generated by InferMatrix Copilot, an open-source repo-maintenance agent for PR review, CI debugging and issue triage. Try it on your own repo, and ⭐ star it if it helped!</sub>
<!-- omni-reviewbot:v1 repo=vllm-project/vllm-omni pr=7840 head=fb41bce236c7b68be732cf54319d62388be4ffe8 -->
<!-- omni-reviewbot:mode-result:v1
{
"assigned_mode": "strict",
"assignment_id": "ma1_db2cf97041e378bcc8e314bfb3a7bab8bc772f4d3b4077049ad86ab7389a1e68",
"attempt_id": "cfaf2f450c65479af1a3c8810f43e00c41cf90794d1c8ad6cfd79bfdce065202",
"backend": "cursor",
"duration_ms": 1890031,
"executed_mode": "direct",
"experiment_id": "fleet-strict-cursor-grok46-zcode-glm53flash-5050-c5-z10-20261002",
"fallback_reason": "fallback: arm strict/cursor/cursor-grok-4.6-high failed 3x (last: backend); executed on the fallback arm direct/cursor/auto; excluded from the arm analysis; auto-review: nightly sweep runs the PR's routing-table arm; excluded from the arm analysis",
"infermatrix_sha": "infermatrix-copilot==0.2.0",
"model": "auto",
"review_depth": "standard",
"reviewbot_sha": "unknown",
"reviewed_head_sha": "fb41bce236c7b68be732cf54319d62388be4ffe8",
"terminal_state": "completed"
}
-->
[P2] seg_gone unlink deletes a lock this get never acquired
<details>
<summary>Evidence and suggested fix</summary>
The new finally in _get_data_with_lock unlinks the lock whenever the segment path is missing, including when LOCK_NB failed. BlockingIOError returns before consumed is set, but finally still runs os.remove(lock_file) when seg_gone is true (shm_connector.py:377-392). That os.remove does not hold flock and does not use the grace / inode recheck in _reclaim_orphan_lock_file.
put() creates the lock and takes LOCK_EX before shm_write_bytes (lines 337-340), so the segment path is absent for the whole critical section. The metadata branch calls _get_data_with_lock with no prior SharedMemory existence check (lines 442-445). A same-key retry that still holds the lock, or any other LOCK_EX holder while the segment is gone, loses the directory entry: put() can return success, and the next get() fails opening the lock (FileNotFoundError under except Exception) and returns None until cleanup() / close(). The key poll path stays outside this window because _get_by_key only enters _get_data_with_lock after SharedMemory(name) succeeds. test_get_failure_dead_segment_removes_lock_file covers a free lock, not LOCK_NB failure.
Unlink on seg_gone only after LOCK_NB succeeds. On BlockingIOError, leave the file for the holder; orphan recovery stays on _reclaim_orphan_lock_file / the gated sweep.
</details>
§6.2/§6.3 updated in 9dc222b21 — they now describe the exact-key unlink
(cleanup() / cleanup_prefix()) and the tracked-key drain + wakeup close,
consistent with §4.3 and the implementation. The no-op wording was left over
from before the wakeup rework.
[P1] Preserve the lock when acquisition fails
This finally block also runs when flock raises BlockingIOError. During a same-key replacement, a reader can open the old segment, fail to acquire the writer-held lock, and then observe the gap between shm_write_bytes unlinking the old segment and creating its replacement. seg_gone becomes true and the reader removes the active writer's lock; the writer then publishes a segment whose lock path is missing, so subsequent get calls cannot read it. Skip this cleanup when lock acquisition fails, or use the guarded orphan-reclaim helper. Please add a regression covering lock contention plus segment disappearance.
[P2] Correct the documented cleanup ownership guarantee
The statement that untracked keys, including keys written by another process, are not touched does not hold for cleanup(key). That method pops the bookkeeping entry without checking membership, then opens and unlinks the named segment and removes its lock file regardless of tracking. A fresh connector can therefore delete a key written by another connector. Restrict the tracked-key guarantee to cleanup_prefix() and close(), and describe cleanup(key) as unconditional exact-key cleanup.
Reviewed head 9dc222b213cd4b99b7469cc9771cf88ddbd9a474 against base 639abb2a9fca94f2f2e0be4df184d3f161e46080. Two findings below.
Validation: SHA-pinned static review and git diff --check completed. Tests were not executed because the fork lacks the sandbox required by the review workflow.
<details>
<summary>Omni ReviewBot attempt record</summary>
Review attempt ended as failed (failed; retrying strict/cursor/cursor-grok-4.6-high in 120s (try 2 of 3)).
</details>
<!-- omni-reviewbot:mode-result:v1
{
"assigned_mode": "strict",
"assignment_id": "ma1_db2cf97041e378bcc8e314bfb3a7bab8bc772f4d3b4077049ad86ab7389a1e68",
"attempt_id": "ac0e76133cdbd11d3200b1ca5f813b096d6b1a210d676e59e368e00b24b78997",
"backend": "cursor",
"duration_ms": 440282,
"executed_mode": "strict",
"experiment_id": "fleet-strict-cursor-grok46-zcode-glm53flash-5050-c5-z10-20261002",
"fallback_reason": "auto-review: nightly sweep runs the PR's routing-table arm; excluded from the arm analysis",
"infermatrix_sha": "infermatrix-copilot==0.2.0",
"model": "cursor-grok-4.6-high",
"review_depth": "standard",
"reviewbot_sha": "unknown",
"reviewed_head_sha": null,
"terminal_state": "failed"
}
-->
<details>
<summary>Omni ReviewBot attempt record</summary>
Review attempt ended as failed (failed; retrying strict/cursor/cursor-grok-4.6-high in 600s (try 3 of 3)).
</details>
<!-- omni-reviewbot:mode-result:v1
{
"assigned_mode": "strict",
"assignment_id": "ma1_db2cf97041e378bcc8e314bfb3a7bab8bc772f4d3b4077049ad86ab7389a1e68",
"attempt_id": "330a1cdcaea1b32a16b16ac2ae00709ee860a88cdf83aa20cd57c74f435eb96f",
"backend": "cursor",
"duration_ms": 107971,
"executed_mode": "strict",
"experiment_id": "fleet-strict-cursor-grok46-zcode-glm53flash-5050-c5-z10-20261002",
"fallback_reason": "auto-review: nightly sweep runs the PR's routing-table arm; excluded from the arm analysis",
"infermatrix_sha": "infermatrix-copilot==0.2.0",
"model": "cursor-grok-4.6-high",
"review_depth": "standard",
"reviewbot_sha": "unknown",
"reviewed_head_sha": null,
"terminal_state": "failed"
}
-->
<details>
<summary>Omni ReviewBot attempt record</summary>
Review attempt ended as failed (failed; falling back to direct/cursor/auto).
</details>
<!-- omni-reviewbot:mode-result:v1
{
"assigned_mode": "strict",
"assignment_id": "ma1_db2cf97041e378bcc8e314bfb3a7bab8bc772f4d3b4077049ad86ab7389a1e68",
"attempt_id": "8f8bf4706b153bcc6f70b2a29ff359fe1928d8731ac52ebd8c65979385c5c8b5",
"backend": "cursor",
"duration_ms": 108587,
"executed_mode": "strict",
"experiment_id": "fleet-strict-cursor-grok46-zcode-glm53flash-5050-c5-z10-20261002",
"fallback_reason": "auto-review: nightly sweep runs the PR's routing-table arm; excluded from the arm analysis",
"infermatrix_sha": "infermatrix-copilot==0.2.0",
"model": "cursor-grok-4.6-high",
"review_depth": "standard",
"reviewbot_sha": "unknown",
"reviewed_head_sha": null,
"terminal_state": "failed"
}
-->
<details>
<summary>Omni ReviewBot attempt record</summary>
Review attempt ended as failed (Cursor exited with 1: ActionRequiredError: You've hit your usage limit You've saved $3501 on API model usage this month with Ultra. Switch to a different model or set a Spend Limit to continue with Auto. Your usage limits will reset when your monthly cycle ends on 10/20/2026.; retrying direct/cursor).
</details>
<!-- omni-reviewbot:mode-result:v1
{
"assigned_mode": "strict",
"assignment_id": "ma1_db2cf97041e378bcc8e314bfb3a7bab8bc772f4d3b4077049ad86ab7389a1e68",
"attempt_id": "a162c1f4736e80ec02e1c62425c39742ff6d85d9448ce4f4240d5b3aa9e9b01b",
"backend": "cursor",
"duration_ms": 37641,
"executed_mode": "direct",
"experiment_id": "fleet-strict-cursor-grok46-zcode-glm53flash-5050-c5-z10-20261002",
"fallback_reason": "fallback: arm strict/cursor/cursor-grok-4.6-high failed 3x (last: backend); executed on the fallback arm direct/cursor/auto; excluded from the arm analysis; auto-review: nightly sweep runs the PR's routing-table arm; excluded from the arm analysis",
"infermatrix_sha": "infermatrix-copilot==0.2.0",
"model": "auto",
"review_depth": "standard",
"reviewbot_sha": "unknown",
"reviewed_head_sha": null,
"terminal_state": "failed"
}
-->
<details>
<summary>Omni ReviewBot attempt record</summary>
Review attempt ended as failed (Cursor exited with 1: ActionRequiredError: You've hit your usage limit You've saved $3501 on API model usage this month with Ultra. Switch to a different model or set a Spend Limit to continue with Auto. Your usage limits will reset when your monthly cycle ends on 10/20/2026.; retrying direct/cursor).
</details>
<!-- omni-reviewbot:mode-result:v1
{
"assigned_mode": "strict",
"assignment_id": "ma1_db2cf97041e378bcc8e314bfb3a7bab8bc772f4d3b4077049ad86ab7389a1e68",
"attempt_id": "036956bd4471db82fbe79f98e7b87a20313c504322561144c616e1c4215ab59e",
"backend": "cursor",
"duration_ms": 35778,
"executed_mode": "direct",
"experiment_id": "fleet-strict-cursor-grok46-zcode-glm53flash-5050-c5-z10-20261002",
"fallback_reason": "fallback: arm strict/cursor/cursor-grok-4.6-high failed 3x (last: backend); executed on the fallback arm direct/cursor/auto; excluded from the arm analysis; auto-review: nightly sweep runs the PR's routing-table arm; excluded from the arm analysis",
"infermatrix_sha": "infermatrix-copilot==0.2.0",
"model": "auto",
"review_depth": "standard",
"reviewbot_sha": "unknown",
"reviewed_head_sha": null,
"terminal_state": "failed"
}
-->
Omni ReviewBot: no human activity for 7 days
@yanbao1217 this pull request has had no human commit, comment or review since 2026-10-11. Please confirm the current plan and next step. The author or a maintainer decides whether to change the PR state.
To keep it moving, any one of these is enough: push an update, reply to the open blocker, or post the current plan and timeline.
<!-- omni-reviewbot:stale:v1 repo=vllm-project/vllm-omni pr=7840 window=2026-10-11T05:10:06+00:00 -->
<!-- omni-reviewbot:quality-note-state:live -->
Omni ReviewBot: no human activity for 18 days
@yanbao1217 this pull request has had no human commit, comment or review since 2026-10-11. Please consider marking this PR as draft until work can resume. The author or a maintainer decides whether to change the PR state.
To keep it moving, any one of these is enough: push an update, reply to the open blocker, or post the current plan and timeline.
<!-- omni-reviewbot:idle:v1 repo=vllm-project/vllm-omni pr=7840 window=2026-10-11T05:10:06+00:00 rung=14 -->
<!-- omni-reviewbot:quality-note-state:live -->
Omni ReviewBot: no human activity for 30 days
@yanbao1217 this pull request has had no human commit, comment or review since 2026-10-11. Please consider closing this PR if the work is no longer planned. The author or a maintainer decides whether to change the PR state.
To keep it moving, any one of these is enough: push an update, reply to the open blocker, or post the current plan and timeline.
<!-- omni-reviewbot:idle:v1 repo=vllm-project/vllm-omni pr=7840 window=2026-10-11T05:10:06+00:00 rung=30 -->
<!-- omni-reviewbot:quality-note-state:live -->
Fixed in cf8392c. If the reader cannot acquire the writer's lock, it returns None before checking whether the segment exists or attempting to unlink the lock file. Read path
The regression test covers the gap you described. With the segment absent and its aged lock held exclusively, a key-only poll leaves the lock file in place. After the holder releases the lock, the next poll reclaims it. The test passed on Linux. Regression test
Updated sections 6.2 and 6.3 in cf8392c. Direct cleanup(key) targets the exact key even on a connector that never published it. Prefix cleanup and close() operate on publications tracked by that sender. Cleanup contract
The prefix cleanup test passed on Linux: it reclaimed the two remaining chunks for one request and the sibling request's payload was still readable. The completion and abort tests also passed when another sender replaced the same key. Prefix test · Same-key tests
@hsliuustc0106, could you take another look at the lock-contention fix and the revised cleanup contract on cf8392c? Both review threads now point to the corresponding code and tests.
[P1] Keep SHM cleanup from blocking the stage's send queue
On Linux, an identified publication takes a blocking flock here. Abort and completion cleanup run on the same serial save thread as normal sends. If a live peer stalls while holding request A's lock, unrelated request B can't send its next chunk. The existing contention test releases the writer as soon as cleanup attempts the lock, so it doesn't cover queue progress while the lock remains held.
Please try the lock without blocking on the send thread and defer busy publications for retry, preserving the original publication identity. Add a regression that keeps A locked until B sends, then checks that deferred cleanup leaves a same-key replacement intact.
AI assistance: OpenAI ChatGPT assisted with static review and drafting. I did not run the tests.
One remaining concern on the current revision: terminal SHM cleanup can block unrelated sends.
Advisory review score: 40/100 (rubric, base a59b7b9 → head cf8392c).
| Dimension | Rating | Evidence |
| --- | ---: | --- |
| Scope and intent | 3/3 | The diff, tests, and docs focus on SHM lock and segment ownership. |
| Correctness and safety | 0/3 | P1: tracked cleanup can block unrelated sends. |
| Validation | 2/3 | Author reports 529 CPU tests passed and 1 skipped. GitHub and docs checks passed; no matching CUDA gate was found. |
| Claim evidence | N/A | Transport lifecycle fix with no model, quality, or performance claim. |
| Simplicity | 0/3 | The diff adds explanatory comments in source and tests, triggering the rubric's zero rule. |
Fix the P1 before merge. Verify that unrelated sends continue while a lock is held and that deferred cleanup preserves a same-key replacement.
AI assistance: OpenAI ChatGPT assisted with static review and drafting; no tests were run independently.
Fixed in 6643812. When terminal cleanup finds a busy SHM lock, the V1 send thread now moves on to the next request. A later retry checks the original segment’s identity before unlinking it.
The Linux regression holds request A’s lock until request B’s chunk is actually read. It then verifies that cleanup reclaims the original segment or leaves a same-key replacement readable. All four abort/completion and original/replacement combinations passed. All 244 tests in the signed-commit run passed, and the PR checks are green.
@hsliuustc0106, could you re-review the send-queue fix and its regression test?
@hsliuustc0106, could you add the merge-test label to run the Buildkite Omni · Qwen3-Omni Async-Chunk SHM Leak test on the current head (2c8184f)?
I updated the PR description with the Linux results. All four regressions failed on 6643812 and passed on 2c8184f. All 464 tests across the three related CPU modules also passed. The CUDA job would verify that a running Qwen3-Omni service cleans up its per-request shared-memory segments and lock files after text-only requests.
@hsliuustc0106, could you re-review e2ae09f and add the merge-test label so Buildkite runs Omni · Qwen3-Omni Async-Chunk SHM Leak on this commit?
This revision preserves same-key replacements when the sender cannot identify its original segment and keeps deferred cleanup scheduled after a temporary error. All seven new regression cases failed on the previous commit and passed on this one. The broader Linux CPU suite passed 876 tests, with one skip. All eight checks reported on GitHub passed.
Omni ReviewBot: no human activity for 7 days
@yanbao1217 this pull request has had no human commit, comment or review since 2026-11-28. Please confirm the current plan and next step. The author or a maintainer decides whether to change the PR state.
To keep it moving, any one of these is enough: push an update, reply to the open blocker, or post the current plan and timeline.
<!-- omni-reviewbot:stale:v1 repo=vllm-project/vllm-omni pr=7840 window=2026-11-28T15:06:56+00:00 -->
<!-- omni-reviewbot:quality-note-state:live -->
hsliuustc0106
yanbao1217
Contributor intent
1. What outcome do you want to achieve?
Reclaim per-key lock files left by interrupted SHM transfers and keep the next transfer using the same key readable. Tracking issue, item 24
2. What is the highest-leverage variable for that outcome?
When the connector unlinks a lock file. A missing segment can mean that the transfer was abandoned or that a writer holds the lock and is still preparing the segment. Original self-review
3. How will this work move that variable?
Take the exclusive lock, verify that the path still names the locked file, and check whether the segment exists before removing an orphan lock. On Linux, record the published segment's device and inode so a deferred release can recognize a same-key replacement.
4. Whose customer or user needs does this address, and what are those needs?
Users of same-host, multi-stage pipelines need interrupted and partially consumed transfers to release their files while active transfers stay readable.
Purpose
A publisher can exit and leave a regular lock file after Python removes the shared-memory segment. The connector verifies the locked file and the absence of the segment before reclaiming an orphan. Key-only reads give new locks a 60-second grace period. Deadline-bound reads skip the directory scan and recheck their deadline under the lock.
V1 terminal cleanup runs on the send thread. MRv2 releases chunks under the lock that protects request registration and output state. Both paths try the publication lock without waiting. If it is busy, the sender can retry an identified publication during later puts or in its idle send loop. Shutdown tries each tracked publication once, skips busy segments, and closes local resources.
Two cases could still lose data or leave an unread segment behind:
cleanup(key)remains available.Independently launched Python processes can have separate resource trackers. On process exit, a tracker can unlink a replacement by name without taking the connector lock. This can leave its lock file behind. SHM cleanup and shutdown contract
Test Plan
vLLM Version: 0.34.0 with PyTorch 2.14.0 and Python 3.12.3 on Linux x86_64
vLLM-Omni Commit:
e2ae09ffd2a7d6dbbb73e12e8d09966e5a010459Run the seven new regression cases on
2c8184fand the fix with identical test files and native Linux shared memory. Run the affected CPU suite on the signed commit:Test Result
2c8184f, all seven new cases failed. Four lost a replacement after tracked cleanup or close. Three stopped retrying after a temporary failure opening the lock, checking segment identity or unlinking the segment.e2ae09f, the same seven cases passed. The broader CPU run passed 876 tests in 149.48 seconds. One test skipped because it found no configuration files. The CPU selection deselected 38 tests.