Repository navigation
fix(session): a failing listener no longer stalls serve (#351) - #356
Merged
Merged
Conversation
`aimdb-core` (serve stops accepting on `Closed`, yields before the accept after any other error, summarizes repeated failures), `aimdb-embassy-adapter` (the listener's own yield is gone), and the root changelog. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YPDjQ947yKjLLAq3Xzgu3e
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.
Description
Fixes #351:
session::servelogged a failedacceptand calledacceptagain at once, and itsselectis biased towardaccept. A listener whoseacceptfailed immediately, every time, keptservespinning without ever polling its open connections again, and the task couldn't be aborted.This merges the feature branch
feat/351-serve-accept-errors. Each fix was reviewed as its own PR into that branch:TransportError::Closedends accepting:serveserves its open connections to their end and returnsacceptafter any other error yields once first (PendingOnce), inside theacceptfuture, so theselectfalls through to the connections and the task stays cancellable. The Embassy TCP listener's own guard is goneaimdb-core,aimdb-embassy-adapter, rootMeasurements from the investigation
acceptsPending(before)Pendingonce before each error (the old Embassy workaround)UnixListenerwithEMFILE(macOS)So with tokio UDS/TCP, the
EMFILEcase named in #351 doesn't spin. The affected cases were listeners that fail withoutPending(a closed channel, third-party transports) and the Embassy listener, which worked around it by yielding itself.Behaviour changes
servereturns once its listener reportsClosedand its last connection has ended (documented onserve). Listeners that never close (UDS, TCP,OneShotListener) keep it running, as before.acceptno longer produces one log line per attempt, only the first one, a summary per order of magnitude, and a line when it recovers.Known gap (documented)
A permanently failing
acceptstill retries without a pause, becauseserveis deliberately timer-free. It no longer blocks anything and barely logs, but it costs CPU. A real back-off was left out on purpose (option 4 of the analysis).Tests
aimdb-core/tests/session_engine.rs, with aScriptedListenerthat hands out one connection and then answers everyacceptwith a fixed error:Closed: the open connection is served, andservereturns after it ends;Io: the open connection is served, andservecan be aborted;AcceptFailures(logging at 1/10/100/1000, series end on success, powers of ten).Verified locally
aimdb-core,aimdb-client,aimdb-uds-connector,aimdb-tcp-connector(including the Embassy loopback overEmbassyTcpListener),aimdb-serial-connector,aimdb-websocket-connectorandaimdb-embassy-adapter.-D warnings) for everyaimdb-corefeature set (includingconnector-sessionwithtracing/log), and foraimdb-embassy-adapterandaimdb-tcp-connector, includingthumbv7em.cargo doc -D warningsforaimdb-core.Related Issue
Checklist
make check). The affected crates pass locally; the full run is left to CI.🤖 Generated with Claude Code
https://claude.ai/code/session_01YPDjQ947yKjLLAq3Xzgu3e