Skip to content

session: make healthcheck tolerance configurable via env vars#33

Open
Trent-TSE wants to merge 5 commits into
masterfrom
devin/1784149195-session-healthcheck-tunables
Open

session: make healthcheck tolerance configurable via env vars#33
Trent-TSE wants to merge 5 commits into
masterfrom
devin/1784149195-session-healthcheck-tunables

Conversation

@Trent-TSE

@Trent-TSE Trent-TSE commented Jul 15, 2026

Copy link
Copy Markdown

Summary

On memory-constrained runners a build can drive the VM into page-cache thrashing (observed: sidestream-tech build linux/arm64 on 4vcpu ARM — 0.04GB mem available, 93% iowait for ~4 min). The stalled buildx client then misses two consecutive session healthchecks and buildkitd tears down the session that carries registry credentials, so the eventual push fails with no active session for <id>: context deadline exceeded (session/auth/auth.go:104).

This makes the daemon-side session healthcheck tunable via env vars, defaults unchanged:

  • BUILDKIT_SESSION_HEALTHCHECK_INTERVAL (default 5s)
  • BUILDKIT_SESSION_HEALTHCHECK_TIMEOUT (default 30s)
  • BUILDKIT_SESSION_HEALTHCHECK_MAX_FAILURES (default 2)

monitorHealth now counts consecutiveFailures against maxFailures instead of the boolean failedBefore (2-strike) logic; a config is parsed once via sync.OnceValue. Invalid values log a warning and fall back to defaults.

setup-docker-builder will set generous values through its existing env.* driver-opt pass-through so cold-cache builds that temporarily max out memory can survive to the push.

Verified with go build ./session/ and go test -vet=off ./session/... (pass; go vet failures on WithTimeoutCause are pre-existing upstream nolint'd lines).

Link to Devin session: https://app.devin.ai/sessions/47b6abfcecd948dcbae7d55badefa46c
Requested by: @Trent-TSE


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled. (Staging)

Under severe memory pressure (e.g. a build maxing out RAM and driving
iowait >90%), the buildx client can stall long enough to miss two
consecutive healthchecks, causing buildkitd to drop the session that
carries registry credentials. The subsequent push then fails with
'no active session ... context deadline exceeded'.

Allow tuning the session healthcheck interval, timeout, and consecutive
failure threshold via BUILDKIT_SESSION_HEALTHCHECK_INTERVAL,
BUILDKIT_SESSION_HEALTHCHECK_TIMEOUT, and
BUILDKIT_SESSION_HEALTHCHECK_MAX_FAILURES. Defaults are unchanged.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit f704ffd. Configure here.

Comment thread session/grpc.go
Trent-TSE and others added 2 commits July 15, 2026 21:04
The per-check cancel left the shadowed loop context done, so the error
branch returned on the first failed healthcheck and the failure
tolerance never applied. Use a dedicated checkCtx for the rpc so only
monitor shutdown short-circuits the loop.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
js-yaml 5.x throws on empty input; the unpinned npm install now pulls
5.x, breaking test/prepare for callers that pass no includes.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Trent-TSE and others added 2 commits July 15, 2026 21:14
Port of moby#6925; the stale
VAGRANT_DISABLE_STRICT_DEPENDENCY_ENFORCEMENT now causes a gem conflict
when installing vagrant-libvirt on the freebsd test job.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The generic/freebsd14 box tracks the EOL 14.0 release whose release_2
pkg repo has been removed, breaking the freebsd test job. Upstream
switched to a pinned bento/freebsd-14 box.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant