Skip to content

fix: remove TCP port probe from verify_port_forwarding after restore#558

Closed
claude-claude[bot] wants to merge 1 commit intofix-pasta-restore-probefrom
claude/fix-22660995451
Closed

fix: remove TCP port probe from verify_port_forwarding after restore#558
claude-claude[bot] wants to merge 1 commit intofix-pasta-restore-probefrom
claude/fix-22660995451

Conversation

@claude-claude
Copy link
Contributor

@claude-claude claude-claude bot commented Mar 4, 2026

CI Fix

Fixes CI #22660134211

Problem

The clone_http/rootless/nginx benchmark panicked on both x64 and arm64 with 0-byte HTTP responses after 10 retry attempts. TCP connections to pasta succeeded but no data was returned.

Root cause: verify_port_forwarding() called wait_for_port_forwarding() after the ping-based ARP verification succeeded. wait_for_port_forwarding() does a bare TcpStream::connect() to the loopback port (127.0.0.3:8080), which goes through pasta's L2 port forwarding to the guest. The connection immediately drops (stream goes out of scope, sending FIN) without exchanging any data. This connect-then-drop pattern creates a half-open entry in pasta's internal connection tracking table that poisons subsequent connections on the same port — causing the next HTTP request to receive 0 bytes.

The original with_restore_mode() fix correctly skipped the port probe in post_start() (before the VM is loaded), but verify_port_forwarding() (called after restore, after ARP resolution) still ran the same poisoning probe.

Solution

Removed the wait_for_port_forwarding() call from verify_port_forwarding(). The ping already confirms the full L2/L3 path through pasta's bridge is working (namespace → bridge → guest). Pasta is listening on the loopback ports (confirmed at startup). Together these guarantee the forwarding chain is functional without needing a TCP port probe that poisons pasta's state.


Generated by Claude | Fix Run

The verify_port_forwarding() method called wait_for_port_forwarding()
after the ping succeeded, which did a bare TcpStream::connect() +
immediate drop through pasta's L2 port forwarding. Even though the
guest was alive and ARP was resolved at this point, the connect-then-
drop created a half-open entry in pasta's connection tracking table
that poisoned subsequent data connections on the same port — causing
0-byte HTTP responses in the bench clone_http test on both x64 and
arm64.

The ping already confirms the full L2/L3 path through pasta's bridge
is working (namespace → bridge → guest). Pasta is listening on the
loopback ports (confirmed at startup). Together these guarantee the
forwarding chain is functional without needing a TCP port probe.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5cbbc1e2dd

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +712 to +716
// Do NOT call wait_for_port_forwarding() here.
// A bare TcpStream::connect() + immediate drop through pasta's
// L2 translation creates a half-open entry in pasta's connection
// tracking table that poisons subsequent connections on the same
// port (0-byte responses). The ping already confirms L2

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep restore path waiting for host port forwards to bind

After snapshot restore, this method now returns success after ping/ARP and explicitly skips wait_for_port_forwarding(). Because post_start() already skips that wait when restore_mode is set, rootless restores with port_mappings now have no check that host TCP forwards are actually accepting connections before health monitoring proceeds. wait_for_port_forwarding() in the same file still documents that pasta binds ports asynchronously (PID file/bridge readiness is not enough), so this change can reintroduce post-restore races where clones look ready but 127.x.y.z:<host_port> is not yet reachable.

Useful? React with 👍 / 👎.

@ejc3
Copy link
Owner

ejc3 commented Mar 4, 2026

Closing: fix already incorporated in PR #555.

@ejc3 ejc3 closed this Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant