Repository navigation
fix(runners): recover from a network outage promptly - #768
Merged
Merged
Conversation
…eep the machine when its reset goes unanswered The runner's HTTP client reused a connection that died in an outage until TCP gave up. It now health-checks HTTP/2 connections and closes idle ones after a request got no answer. A reset left unanswered for a session that lost contact no longer fails the machine. Signed-off-by: Alex <[email protected]>
…age-recovery Signed-off-by: Alex <[email protected]> # Conflicts: # CHANGELOG.md
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.
What changed
Fixes #256 (found by #252 step 9): after a network outage the runner kept writing to a dead connection for 18 minutes, and the machine went Failed.
runner/internal/protocol/client.go). The default HTTP client now pings an HTTP/2 connection silent for 15 s and closes it if the ping is not answered in 10 s, bounds dialing, enables TCP keep-alives, and closes idle connections after a request got no answer. A request that timed out in the outage no longer leaves its dead connection in the pool for the next poll, heartbeat or token request.RunnerRuntime#cleanup_session). A machine could be "heard" by a request whose answer never reached the runner, so the cleanup sentenv.reset, nobody answered, and the machine was failed ("the runner did not answer"). For a session that lost contact, an expiredenv.resetnow leaves the session holding the machine; the cleanup sends a new reset when the machine is heard again (DESIGN.md §6.7).Release
This PR does not release the runner. #264 releases
aixle-runner0.4.1 after all the #252 fixes are merged, and pins its digests and the recommended version inconfig/settings.yml(runners.release).How to test
cd runner && go vet ./... && go test -race ./...;TestARequestAfterAConnectionDiedSilentlyDialsAgainkills a connection without closing it and shows the next poll reaches the server.bin/rails test test/services/container_runtime/runner_runtime_test.rb: an unanswered reset of a lost-contact session keeps the machine, which resets and goes idle when heard.