feat(daemon): raise trace socket receive buffer to absorb trace2 bursts - #1762
Merged
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
devin-ai-integration Bot
added a commit
that referenced
this pull request
Jul 8, 2026
…th checks Replace the trace-ingest drain watchdog (which restarted the daemon on a detected stall, risking memory spikes and restart loops) with a liveness ping/sentinel mechanism that alerts instead of restarting. The socket health-check loop now sends a Ping control request and a trace sentinel line each tick, tracking when each socket last acknowledged a ping (control: request round-trips; trace: the reader stamps a received-timestamp). If a socket goes unacknowledged past a generous threshold it warns exactly once per stall episode. The pre-existing connect-probe restart safety net for a dead listener is retained unchanged. Socket receive-buffer tuning is split out into a separate PR (#1762). Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…nection A Unix-domain listener's SO_RCVBUF is not inherited by accepted connections, so the listener-level call was a no-op wasted syscall with a misleading comment. Keep only the per-connection buffer bump, which is what takes effect. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…lake) Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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
Git writes trace2 frames synchronously to the daemon's Unix socket. With small kernel socket buffers (macOS defaults to ~8 KiB), a bursty trace2 stream can fill the receive buffer and block the raw
gitprocess inwrite()until the daemon drains it — the back-pressure freeze class flagged for larger change-sets. This raises the trace socket'sSO_RCVBUFso those bursts are absorbed in-kernel.Shipped as a small, standalone PR so it can land independently of the socket-drain health work.
What changed (Unix only; Windows uses named pipes and is untouched):
TRACE_SOCKET_RECV_BUFFER_BYTES), and is overridable at runtime viaGIT_AI_TRACE_SOCKET_RECV_BUFFER_BYTESso it can be ramped toward 1 MiB without a code change.0disables the bump.setsockoptcode are#[cfg(not(windows))]; Windows trace ingestion uses named pipes, so there is nothing to gate there.Important: this is a mitigation, not a guarantee. A larger buffer absorbs bursty trace output, but any finite buffer can still fill if the daemon genuinely stops draining — that drain-stall detection is handled separately (ping/sentinel health check, #1735).
Testing
set_socket_recv_bufferraises a socket'sSO_RCVBUFtoward the target. The assertion is robust to Linux clampingSO_RCVBUFtonet.core.rmem_max(CI runners default to ~208 KiB): it passes if the buffer reaches the target or grows past the socket's default baseline.cargo fmt,cargo clippy --all-targets -- -D warnings,cargo docall clean (Rust 1.93.0, matching CI).Link to Devin session: https://app.devin.ai/sessions/a9931f84ae914fcc82663a2e52106bd5
Requested by: @Siddhant-K-code