mirror of
https://github.com/kvcache-ai/AgentENV.git
synced 2026-11-05 01:17:36 +00:00
[GH-ISSUE #392] bug(ublk-daemon): undelivered acquire responses leak devices and shared references #100
Labels
No labels
bug
documentation
enhancement
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/AgentENV#100
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @dushulin on GitHub (Oct 19, 2026).
Original GitHub issue: https://github.com/kvcache-ai/AgentENV/issues/392
Summary
A shared OverlayBD acquisition can complete after its caller has timed out or disconnected. The daemon records the acquired device/reference before sending the response. If response delivery fails, the handler returns without releasing the acquisition. The caller never receives the result needed to own and release it.
This leaves an active acquisition with no corresponding client owner. Repeated failures can accumulate devices or shared references.
Environment and verification scope
ublk-daemon, shared memory devices used for snapshot restore, with device pooling enabled.ublk_drv, OverlayBD.0ce8eb9bd94d8656b0a40e5be7cdfadfd6e78b45.Observed behavior
The following sequence was observed repeatedly. Logs are normalized, with timestamps and identifiers removed:
The device remained LIVE and held by the daemon. No subsequent release appeared in the retained lifecycle logs, and no Firecracker FD or mmap referencing it was observed. Normal idle placeholder devices were excluded from this classification.
For an affected device whose backing layer later became inaccessible, a host inventory operation (
fdisk -l) triggered header reads and exposed the following errors:The inventory read exposed the retained device; it did not cause the leak. An orphan with readable backing data can persist without this warning.
The original reason acquisition exceeded 30 seconds, and why the backing layer later became inaccessible, have not been established. The
-ENOENTobservation does not establish that unlinking an open local file caused the I/O failure.Source analysis
At the reviewed public revision:
UblkDaemonClient::callwraps the RPC in a timeout; the inner operation owns the connection.acquire_sharedinserts a new active shared entry or increments an existing shared reference before returningDeviceAcquired.send_message(...).await?. A failed send exits the handler without rolling back that acquisition.The acquisition remains recorded as active, so the normal client-release path cannot return the abandoned acquisition to the pool. The runtime observation concerns an acquired shared device; the existing-reference leak is a source-level finding. Other resource-creating handlers have not been reproduced here.
Proposed regression coverage
This procedure is proposed and has not yet been executed:
AcquireOverlaybdwith shared access. At the barrier, close the client connection without consuming the result.Coverage should also include timeout/cancellation and a response successfully written before the caller abandons the result. Failed-send rollback alone does not cover that last ownership handoff window; the fix should define how abandoned acquisitions are identified and released.
Expected behavior and impact
Unreleased devices can retain device slots, file descriptors, worker threads, and buffers, potentially preventing later sandbox creation or restore. Leaked references to an existing shared device can prevent its release after valid users finish. If an orphan's backing data becomes inaccessible, later reads can additionally produce kernel I/O warnings.