From db3f1cd58fa85254ec7642796f4b9053e8ee835a Mon Sep 17 00:00:00 2001 From: Jiuyi Liu <61373921+Luckydog691@users.noreply.github.com> Date: Tue, 15 Sep 2026 17:33:20 +0800 Subject: [PATCH] envd: skip MMDS polling in containerized (isNotFC) deployments 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. --- packages/envd/internal/api/init.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/envd/internal/api/init.go b/packages/envd/internal/api/init.go index 093919e213..16c3cef07e 100644 --- a/packages/envd/internal/api/init.go +++ b/packages/envd/internal/api/init.go @@ -294,11 +294,17 @@ func (a *API) PostInit(w http.ResponseWriter, r *http.Request) { a.initialized.Store(true) } - go func() { //nolint:contextcheck // TODO: fix this later - ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second) - defer cancel() - host.PollForMMDSOpts(ctx, a.mmdsChan, a.defaults.EnvVars) - }() + // MMDS is only served by the Firecracker-based deployment: containerized + // environments (isNotFC) have no metadata service, where the futile polling + // leaks dangling in-flight connections and can break runsc checkpointing. + // Mirror the guard in main.go and skip it. + if !a.isNotFC { + go func() { //nolint:contextcheck // TODO: fix this later + ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second) + defer cancel() + host.PollForMMDSOpts(ctx, a.mmdsChan, a.defaults.EnvVars) + }() + } // After SetData, so this reports what is actually in effect rather than what was // requested. Set before WriteHeader.