From edbf01b1e8381e585c54e4c21aefb5cc518ef8d2 Mon Sep 17 00:00:00 2001 From: Jiuyi Liu <61373921+Luckydog691@users.noreply.github.com> Date: Wed, 16 Sep 2026 21:52:02 +0800 Subject: [PATCH] fix(envd): skip MMDS polling in containerized deployments MMDS is not served in containerized (isNotFC) environments: the futile polling leaks dangling in-flight connections and can break runsc checkpointing. Mirror the guard in main.go. --- packages/envd/internal/api/init.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/envd/internal/api/init.go b/packages/envd/internal/api/init.go index 093919e213..8422163be1 100644 --- a/packages/envd/internal/api/init.go +++ b/packages/envd/internal/api/init.go @@ -294,11 +294,13 @@ 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) - }() + 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.