Repository navigation
Conversation
Dialling a peer while no signer answers freezes connectd: its ECDH is a blocking hsmd call on its single thread, which stalls all peer I/O until a signer replies. The plugin had no signal to avoid that: the signer count only drops when a send fails, so a backgrounded app with a half-open stream still counts as attached. The stage now tracks signer presence, Answering or Silent, as a watch that can go back to Silent. A signer is Answering after its first reply following an attach, including error replies. It is Silent once its stream exits, or once a request has gone unanswered for 10 s, counted from the later of staging and the last reply, so a freshly attached signer is not blamed for the backlog it inherits. `check_answering` is the dial gate: a reply within 10 s answers at once, otherwise it stages a GetHeartbeat probe (ids below hsmproxy's range) and waits up to 5 s; concurrent callers share one probe. `await_answering` waits for a signer within a deadline. ECDH joins the stuck request types, and the request stream task now ends as soon as the signer drops the stream.
This branch has not been deployed
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.
Summary
Dialling a peer while no signer answers freezes
connectd: its ECDH is a blocking hsmd call on its only thread. The plugin had no signal to avoid that.SIGNER_COUNTonly drops when a send fails, so a backgrounded app with a half-open stream still counts as attached.The
Stagenow tracks signer presence, awatchthat can go back toSilent:The dial gate that callers ask right before each
connect:Also:
Evidence
New unit tests in
stager.rs, run with paused tokio time (cargo test -p gl-plugin --lib stager, 13 passed):AnsweringSilent; at 9 s stillAnsweringAnsweringuntil 10 s without a replySilent; a late reply from a detached signer doesn't revive itSilentat onceSilent, probe clearedGetHeartbeatprobeawait_answeringreturns when a signer attaches, or false at the deadlineMerge Danger
Door: two-way
Additive API on
Stage. Nothing in this crate dials through the gate yet. The internal plugin adopts it in a separate change.Blast Radius: small
GetHeartbeatrequests, the same as the one sent on attach.stuck, which can affect scheduler decisions that use that flag.tokiotest-utilis a dev-dependency only.