Add retry logic with exponential backoff for AgentRun RPC calls #1882
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.
Proposed changes
AgentRunRPC calls fail with "code = Unavailable desc = transport is closing" when agents are temporarily unavailable or busy, especially under high concurrent load. This results in missed job executions.Implementation
Configuration (3 new settings, all optional):
agent-run-max-retries(default: 3) - Maximum retry attemptsagent-run-retry-initial-interval(default: 1s) - Initial backoffagent-run-retry-max-interval(default: 30s) - Backoff capRetry Logic:
Unavailable,DeadlineExceeded,ResourceExhausted,Aborted,InternalUsage:
dkron agent --agent-run-max-retries=5 \ --agent-run-retry-initial-interval=2s \ --agent-run-retry-max-interval=60sOr via config file:
Testing
Types of changes
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
127.0.0.10/tmp/go-build3328612238/b001/dkron.test /tmp/go-build3328612238/b001/dkron.test -test.testlogfile=/tmp/go-build3328612238/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true -test.run=TestGRPCExecutionDone -trimpath ux_amd64/vet -p d/autoscaling/v2-atomic -lang=go1.23 ux_amd64/vet -W kg_.a om/golang/protob-ifaceassert ux_amd64/vet . ateway/v2/utilit-atomic --64 ux_amd64/vet(packet block)/tmp/go-build264584732/b001/dkron.test /tmp/go-build264584732/b001/dkron.test -test.testlogfile=/tmp/go-build264584732/b001/testlog.txt -test.paniconexit0 -test.run=TestAgent|TestJob|TestScheduler -test.timeout=5m0s n4Jnfa_9W .cfg ux_amd64/vet s.go nt.go -lang=go1.24 ux_amd64/vet -o elemetry.io/cont-errorsas .cfg ux_amd64/vet -p ery/pkg/util/man--norc -lang=go1.21 ux_amd64/vet(packet block)/tmp/go-build3508022003/b001/dkron.test /tmp/go-build3508022003/b001/dkron.test -test.testlogfile=/tmp/go-build3508022003/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s --ctstate INVALID,NEW -j DROP -p github.com/moderls-files -lang=go1.12 ux_amd64/vet(packet block)127.0.0.11/tmp/go-build264584732/b001/dkron.test /tmp/go-build264584732/b001/dkron.test -test.testlogfile=/tmp/go-build264584732/b001/testlog.txt -test.paniconexit0 -test.run=TestAgent|TestJob|TestScheduler -test.timeout=5m0s n4Jnfa_9W .cfg ux_amd64/vet s.go nt.go -lang=go1.24 ux_amd64/vet -o elemetry.io/cont-errorsas .cfg ux_amd64/vet -p ery/pkg/util/man--norc -lang=go1.21 ux_amd64/vet(packet block)/tmp/go-build3508022003/b001/dkron.test /tmp/go-build3508022003/b001/dkron.test -test.testlogfile=/tmp/go-build3508022003/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s --ctstate INVALID,NEW -j DROP -p github.com/moderls-files -lang=go1.12 ux_amd64/vet(packet block)/tmp/go-build2409181327/b001/dkron.test /tmp/go-build2409181327/b001/dkron.test -test.testlogfile=/tmp/go-build2409181327/b001/testlog.txt -test.paniconexit0 -test.run=Test_getTargetNodes -test.timeout=2m0s(packet block)127.0.0.13/tmp/go-build3508022003/b001/dkron.test /tmp/go-build3508022003/b001/dkron.test -test.testlogfile=/tmp/go-build3508022003/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s --ctstate INVALID,NEW -j DROP -p github.com/moderls-files -lang=go1.12 ux_amd64/vet(packet block)127.0.0.14/tmp/go-build3508022003/b001/dkron.test /tmp/go-build3508022003/b001/dkron.test -test.testlogfile=/tmp/go-build3508022003/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s --ctstate INVALID,NEW -j DROP -p github.com/moderls-files -lang=go1.12 ux_amd64/vet(packet block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.