feat(gl-signerproxy): convert to fully async tokio#728
Open
cdecker wants to merge 2 commits into
Open
Conversation
Replace the sync/threaded architecture with a fully async implementation: - passfd: new AsyncFdPassingExt trait on tokio::net::UnixStream using async_io() + MSG_DONTWAIT so SCM_RIGHTS fd passing integrates with Tokio's readiness machinery without blocking - wire: DaemonConnection now wraps tokio::net::UnixStream directly; read/write are async fns using AsyncReadExt/AsyncWriteExt; no Mutex needed as each connection is exclusively owned by its task - hsmproxy: process_requests is a plain async fn; start_handler is a sync wrapper calling tokio::spawn to avoid recursive async types; Arc<Runtime> and all block_on calls removed Fix: use std::os::unix::net::UnixStream::pair() for the remote end of new subdaemon connections (type-9 handler). tokio::UnixStream::pair() sets O_NONBLOCK on both ends via mio; SCM_RIGHTS inherits fd flags, so CLN's C subdaemons received a non-blocking socket and got EAGAIN on every blocking read/write. The local end is converted to Tokio via set_nonblocking(true) + UnixStream::from_std(). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Brings gl-signerproxy in line with the rest of the workspace. tonic-build build-dep updated to match. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
0e4aced to
856d7ae
Compare
3 tasks
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
gl-signerproxyarchitecture with a fully async Tokio implementation across three files (passfd.rs,wire.rs,hsmproxy.rs)AsyncFdPassingExttrait ontokio::net::UnixStreamusesasync_io()+MSG_DONTWAITto integrate SCM_RIGHTS fd passing with Tokio's readiness machinerytokio::UnixStream::pair()sets both ends non-blocking via mio; when the remote fd is passed to lightningd viaSCM_RIGHTS, CLN's C subdaemons receive a non-blocking socket and immediately getEAGAIN. Fix: usestd::os::unix::net::UnixStream::pair()for the remote end, then convert only the local end to Tokio0.8→0.11and prost0.11→0.12to match the rest of the workspaceTest plan
cargo check --package gl-signerproxycompiles cleanlypytest tests/test_all.py::test_gossipd_immediate_syncpasses (this is the test that caught the O_NONBLOCK bug)pytest tests/test_all.py::test_startpassescargo tree -p gl-signerproxy --duplicatesshows no duplicate tokio or tonic🤖 Generated with Claude Code