Skip to content

fix(envd): skip MMDS polling on /init when running outside Firecracker - #3638

Closed
Luckydog691 wants to merge 1 commit into
e2b-dev:mainfrom
Luckydog691:fix/envd-skip-mmds-poll-isnotfc
Closed

Luckydog691 wants to merge 1 commit into
e2b-dev:mainfrom
Luckydog691:fix/envd-skip-mmds-poll-isnotfc

Conversation

@Luckydog691

Copy link
Copy Markdown

Problem

envd started with -isnotfc runs outside Firecracker. The flag is documented as "run outside of Firecracker (skips MMDS poll and HTTP log exporter)", and main.go correctly guards its startup poll with if !isNotFC.

The /init handler, however, starts the same 60s MMDS polling loop unconditionally. Every attempt opens a TCP connection to 169.254.169.254:80; with no MMDS endpoint reachable, the handshake never completes and the connection stays in SYN_SENT for the whole poll window (visible in /proc/net/tcp).

That dangling half-open connection becomes fatal when the sandbox is checkpointed: a gVisor (runsc) checkpoint taken while such a connection exists panics in the TCP endpoint save path (resetConnectionLocked dereferences a nil snd/rcv), so checkpointing fails deterministically for the whole poll window.

Fix

Mirror the guard main.go already applies to its startup poll and skip the MMDS polling in /init when isNotFC is set. Firecracker-based deployments are unchanged.

Testing

  • In a containerized deployment, a SYN_SENT connection to 169.254.169.254:80 is observable for ~60s after /init before the change; with the change it never appears.
  • Checkpointing a runsc sandbox that is inside that window fails before the change and succeeds after it (checkpoint + restore round trip verified).
  • go build ./... and go test ./internal/api/ pass.

The /init handler unconditionally started the 60s MMDS polling loop even
when envd runs with -isnotfc, where no Firecracker MMDS endpoint exists.
The futile polls leak dangling in-flight connections, which can break
runsc checkpointing. Mirror the guard already used in main.go and skip
the polling.
@cla-bot

cla-bot Bot commented Sep 15, 2026

Copy link
Copy Markdown

We require contributors to sign our Contributor License Agreement, and we don't have @Luckydog691 on file. You can sign our CLA at https://e2b.dev/docs/cla . Once you've signed, post a comment here that says '@cla-bot check'

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