Count half-open inbound connections as auto-standby activity#312
Merged
Conversation
sjmiller609
marked this pull request as ready for review
July 22, 2026 15:35
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 9b90d2b. Configure here.
A client mid-handshake (conntrack SYN_SENT) now counts as inbound activity: a freshly restored guest can take several seconds to answer the SYN it was woken for, and with SYN_SENT invisible the idle timer could fire during the handshake and put the VM back into standby with the request in flight. Since wake-on-traffic does not exist, that connection then hung until the client gave up. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
sjmiller609
force-pushed
the
hypeship/autostandby-synsent-prepause-check
branch
from
July 22, 2026 15:41
9b90d2b to
0fa9fd6
Compare
hiroTamada
approved these changes
Jul 22, 2026
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
Fixes a race where auto-standby pauses a VM while a client is connecting to it. Since wake-on-traffic does not exist, that connection then hangs until the client gives up.
SYN_SENTnow counts as inbound activity (TCPState.Active()). A freshly restored guest can take several seconds to answer the SYN it was woken for; previously the mid-handshake flow was invisible to the idle tracker, so the idle timer could fire during the handshake and put the VM straight back into standby with the request in flight.Trade-off
A half-open inbound flow that never completes (e.g. the client vanishes without RST) now keeps the VM awake until conntrack expires the entry (
nf_conntrack_tcp_timeout_syn_sent, default 120s).ignore_source_cidrs/ignore_destination_portsstill apply.Testing
go test ./lib/autostandby/passes.TestAutoStandbyCloudHypervisorHalfOpenInboundTCP(adapted from the existing auto-standby e2e): boots nginx in a cloud-hypervisor VM, drops the guest's replies in the raw table so the host-side flow stays in SYN_SENT while the client retransmits, and asserts the VM stays running past the idle timeout; then lifts the drop, completes the handshake, and confirms the normal idle→standby path still works. Verified on a Linux/KVM host: both this test and the pre-existingTestAutoStandbyCloudHypervisorActiveInboundTCPpass (HYPEMAN_RUN_AUTO_STANDBY_E2E=1). Without the fix the half-open flow never counts as activity and the VM standbys mid-handshake.🤖 Generated with Claude Code
Note
Medium Risk
Changes when VMs enter standby (lifecycle-critical); stuck half-open inbound TCP can delay standby for up to conntrack’s SYN_SENT timeout.
Overview
Fixes a race where auto-standby could pause a VM while a client was still connecting—problematic because there is no wake-on-traffic, so the in-flight request would hang.
TCPState.Active()now treatsSYN_SENTlike other live inbound states, so host-side conntrack flows for clients mid-handshake (including a freshly restored guest that has not answered the SYN yet) keep the VM running through both event handling and snapshot classification. Docs note this behavior and the trade-off that a stuck half-open flow can hold the VM awake until conntrack expires the entry.Tests add classifier/controller coverage for
SYN_SENT, refactor shared auto-standby e2e setup, and addTestAutoStandbyCloudHypervisorHalfOpenInboundTCP, which drops guest replies with iptables so the flow stays half-open past the idle timeout and asserts the VM stays up until the handshake completes and the normal idle→standby path still works.Reviewed by Cursor Bugbot for commit 0fa9fd6. Bugbot is set up for automated code reviews on this repo. Configure here.