fix: bound live Docker inspect calls with a timeout - #450
Merged
Merged
Conversation
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
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
network.go,exec.go, andresources_live_apply.goall calledInspectByNamewith 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 withorigin/main(picking up the zero-config fallback domain and CSP/HSTS work merged in the meantime), with the resulting conflict innetwork_test.goresolved as a straightforward union of both branches' new tests.What this doesn't do
dockerInspectTimeoutconfigurable 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."