Skip to content

fix: bound live Docker inspect calls with a timeout - #450

Merged
thegdsks merged 2 commits into
mainfrom
fix/bound-docker-inspect-timeout
Sep 14, 2026
Merged

thegdsks merged 2 commits into
mainfrom
fix/bound-docker-inspect-timeout

Conversation

@thegdsks

Copy link
Copy Markdown
Member

Summary

network.go, exec.go, and resources_live_apply.go all called InspectByName with the bare request context, which carries no deadline of its own. A slow or unresponsive Docker daemon turned that into an unbounded hang: reported live (the Network tab's page load taking minutes instead of failing fast). Wraps each call in a bounded context (dockerInspectTimeout, 3s) so these degrade to their existing "status unknown" fallback instead of hanging the request.

Originally built and tested against an earlier main; this branch has since been merged forward with origin/main (picking up the zero-config fallback domain and CSP/HSTS work merged in the meantime), with the resulting conflict in network_test.go resolved as a straightforward union of both branches' new tests.

What this doesn't do

  • Doesn't add a timeout to every Docker API call in this codebase, only the three live-inspect call sites that were reported as actually hanging a page load; other Docker calls already run inside a request context with its own natural bound (e.g. build/deploy operations) or aren't on a synchronous user-facing request path.
  • Doesn't make dockerInspectTimeout configurable via an env var; 3s is a fixed constant, short enough to keep a page responsive, long enough that a healthy but briefly busy daemon won't false-positive into "unknown."

network.go, exec.go, and resources_live_apply.go all called
InspectByName with the bare request context, which carries no deadline
of its own. A slow or unresponsive Docker daemon turned that into an
unbounded hang: reported live, this made the Network tab's page load
take minutes instead of failing fast. Wraps each call in a bounded
context (dockerInspectTimeout, 3s) so these degrade to their existing
"status unknown" fallback instead of hanging the request.
…ect-timeout

# Conflicts:
#	internal/api/network_test.go
@thegdsks
thegdsks merged commit 1f98102 into main Sep 14, 2026
5 checks passed
@github-actions github-actions Bot added the size/xs < 10 lines changed label Sep 14, 2026
@thegdsks
thegdsks deleted the fix/bound-docker-inspect-timeout branch September 14, 2026 03:30
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/xs < 10 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant