Repository navigation
Route module IPC replies and events through one reader - #73
Merged
Merged
Conversation
secsovereign
left a comment
Member
There was a problem hiding this comment.
Review
Direction is right. This is the node-side fix for the GridPool ZMQ path where an interleaved Event before a Response blew up correlation / unexpected message type, and where a background reader held the client mutex so concurrent NodeAPI calls stalled. One session owner demuxing by correlation ID is the correct shape.
Clippy / Format / Docs / Fuzz / Verify / Frozen paths are green. The red checks break down as follows.
Must-fix before merge (this PR)
- Conventional Commits — subject
Route module IPC replies and events through one readerfails the checker. Re-title / amend to something likefix(module): route IPC replies and events through one reader. - Test — sole failure is the new unit test:
module::ipc::session::tests::routes_event_before_response_and_keeps_idle_session_writable
Panic atsession.rs:95:
UnixListener::bind→InvalidInput: path must be shorter than SUN_LEN
Runner tempfile paths are longer thansockaddr_un. Bind under a short path (e.g./tmp/blvm-ipc-XXXX.sockor a shorttempfilename), nottempdir()/module.sock.
Pre-existing on main (not introduced here, but blocks CI)
- Security / cargo-deny — hard-fail on
url2.5.8 → RUSTSEC-2026-0592 (Url::origin()stack overflow on nestedblob:). Fix iscargo update -p url(≥2.5.9) onmain(or a tiny follow-up). Unmaintained advisories (bincode, chrono, …) are warnings only; the hard fail isurl.
Design notes (non-blocking)
- One outstanding request (
pending) is a deliberate serialization of the session; fine for modules, worth a one-line comment so nobody “optimizes” it into a map without thinking about write ordering. - Invocation backpressure at 32 +
try_send→ error result is good; same for dropping events when no subscribers. - Windows client still mutex-gated; OK for now given unix is the native module path.
Merge posture
Approve the design once (1)+(2) are fixed and either url is bumped on main or this branch picks up that lock bump. Stack with #75 (grants → instance id) after this lands; pair with BTCDecoded/blvm-zmq#1 / 0.1.7 for the module binary rebuild against 0.1.104 IPC.
secsovereign
pushed a commit
that referenced
this pull request
Nov 22, 2026
Register nonempty capability lists on the issued session id so hub authz matches the running module (fixes ReadMempool deny for ZMQ). Subscribe only after a successful response; revoke grants on teardown. Depends on the session demux from #73.
1 task done
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.
Problem
In beta.6,
ModuleIntegrationstarts a background receiver that holds the IPC client mutex while waiting for a frame. A module API call can then wait indefinitely on an idle connection. If a call does get the mutex, its synchronous request path assumes the next frame is the reply. An ordinary block-event burst interleaves events and replies, producingReceived unexpected message typeand response correlation mismatches. We observed this when blvm-zmq fetched blocks forrawblock; see BTCDecoded/blvm-zmq#1 for the complementary module startup and wire-framing fixes.Change
After the existing handshake and CLI registration, a single task owns the session. It routes replies to the outstanding request by correlation ID, broadcasts events, and forwards invocations without waiting on the invocation handler before reading again. Request and invocation queues are bounded. The wire format, handshake, permissions, and direct synchronous client remain unchanged.
Verification
hashblockandrawblockwith sequence 102 for the same SV2-mined tip, and validated the header from the raw notification. Transaction topics were disabled for this block-notification test.The separate manifest-grant issue for
ReadMempoolis not addressed here.