Skip to content

Stop retrying timeout error when dispatching worker command - #11851

Merged
rkannan82 merged 3 commits into
mainfrom
kannan/worker-cmd-no-retry-timeout
Sep 2, 2026
Merged

Stop retrying timeout error when dispatching worker command#11851
rkannan82 merged 3 commits into
mainfrom
kannan/worker-cmd-no-retry-timeout

Conversation

@rkannan82

@rkannan82 rkannan82 commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

What

Stop retrying worker command dispatch when the failure is a poller timeout (UpstreamTimeout). Transport errors (gRPC unreachable, connection refused) are still retried.

Why

When a worker is gone, each DispatchNexusTask attempt blocks a goroutine for the full 10s dispatch timeout waiting for a poller that will never arrive. With 3 max attempts, that's ~32s of blocked resources per command.

At scale this adds up: if many workers go away simultaneously (e.g., deployment rollout), each dead worker can accumulate pending cancel commands. With per-destination concurrency of 100, this means up to 100 goroutines × N dead workers × 10s per attempt × 3 attempts — thousands of goroutines blocked on matching RPCs, causing memory pressure and connection buildup.

Since worker commands are best-effort, there's no value in retrying after the first timeout. If no poller appeared in 10s, the worker is likely gone.

How did you test it?

  • Unit tests: updated TestExecute_UpstreamTimeout and TestHandleError_UpstreamTimeout_ReturnNil to verify no retry on timeout while transport errors still retry.

🤖 Generated with Claude Code

@rkannan82
rkannan82 force-pushed the kannan/worker-cmd-no-retry-timeout branch from d65cbbf to 3ba111c Compare August 28, 2026 20:23
When no worker is polling a control queue, the Nexus dispatch returns
UpstreamTimeout after 10s. Previously this was retried up to 3 times,
blocking a history goroutine for ~32s total per dead worker. At scale
with many activity-worker deployments, this wastes goroutines on workers
that are already gone.

Return nil (non-retryable) on UpstreamTimeout instead. A single 10s
attempt is sufficient to detect a missing poller.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@rkannan82
rkannan82 requested a review from a team August 29, 2026 18:23
@rkannan82
rkannan82 requested review from a team as code owners August 29, 2026 18:23
@github-actions

github-actions Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Claude finished @rkannan82's task in 2m 29s —— View job


Reviewed 2 files, 2 findings.
· kannan/worker-cmd-no-retry-timeout

@rkannan82 rkannan82 changed the title Reduce time to detect missing worker command pollers Reduce time to detect missing pollers for worker command due to non existent worker Aug 29, 2026
Comment thread common/workercommands/dispatcher.go Outdated
Comment thread common/workercommands/dispatcher.go
@rkannan82 rkannan82 changed the title Reduce time to detect missing pollers for worker command due to non existent worker Reduce time to detect missing non existent worker when dispatching worker command Aug 29, 2026
@rkannan82 rkannan82 changed the title Reduce time to detect missing non existent worker when dispatching worker command Reduce time to detect non existent worker when dispatching worker command Aug 29, 2026
@rkannan82 rkannan82 changed the title Reduce time to detect non existent worker when dispatching worker command Stop retrying timeout error when dispatching worker command Sep 1, 2026
@rkannan82
rkannan82 requested a review from yiminc September 1, 2026 21:31
@rkannan82 rkannan82 added the reliability-2026 Reliability related changes label Sep 1, 2026
…retry-timeout

# Conflicts:
#	common/workercommands/dispatcher.go
@rkannan82
rkannan82 enabled auto-merge (squash) September 2, 2026 04:45
@rkannan82
rkannan82 disabled auto-merge September 2, 2026 04:46
@rkannan82
rkannan82 enabled auto-merge (squash) September 2, 2026 04:47
@rkannan82
rkannan82 merged commit a108773 into main Sep 2, 2026
55 checks passed
@rkannan82
rkannan82 deleted the kannan/worker-cmd-no-retry-timeout branch September 2, 2026 05:01
thestephenstanton pushed a commit that referenced this pull request Sep 2, 2026
## What

Stop retrying worker command dispatch when the failure is a poller
timeout (UpstreamTimeout). Transport errors (gRPC unreachable,
connection refused) are still retried.

## Why

When a worker is gone, each `DispatchNexusTask` attempt blocks a
goroutine for the full 10s dispatch timeout waiting for a poller that
will never arrive. With 3 max attempts, that's ~32s of blocked resources
per command.

At scale this adds up: if many workers go away simultaneously (e.g.,
deployment rollout), each dead worker can accumulate pending cancel
commands. With per-destination concurrency of 100, this means up to 100
goroutines × N dead workers × 10s per attempt × 3 attempts — thousands
of goroutines blocked on matching RPCs, causing memory pressure and
connection buildup.

Since worker commands are best-effort, there's no value in retrying
after the first timeout. If no poller appeared in 10s, the worker is
likely gone.

## How did you test it?

- Unit tests: updated `TestExecute_UpstreamTimeout` and
`TestHandleError_UpstreamTimeout_ReturnNil` to verify no retry on
timeout while transport errors still retry.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

reliability-2026 Reliability related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants