Skip to content

no longer cancel pending polls on shutdown#1122

Merged
yuandrew merged 4 commits intotemporalio:masterfrom
yuandrew:shutdown-poll-complete
Feb 23, 2026
Merged

no longer cancel pending polls on shutdown#1122
yuandrew merged 4 commits intotemporalio:masterfrom
yuandrew:shutdown-poll-complete

Conversation

@yuandrew
Copy link
Copy Markdown
Contributor

@yuandrew yuandrew commented Feb 20, 2026

What was changed

If worker_poll_complete_on_shutdown namespace capability exists, then don't cancel outstanding poll requests on shutdown. Instead expect server to return an empty result.

Why?

During worker shutdown, the SDK cancels outstanding poll requests client-side by racing them against the shutdown token. This
creates a race condition: the server may dispatch a task to a poll at the same instant the SDK kills the connection, orphaning the
task until start_to_close timeout.

Checklist

  1. Closes

  2. How was this tested:

Added new test verifying graceful shutdown behavior

  1. Any docs updates needed?

Note

Medium Risk
Touches generated/public OpenAPI surface area (path reshapes and endpoint additions/removals), which can break client integrations; the new CI guard is low risk but may block builds if it flags previously unnoticed conflicts.

Overview
Updates the generated OpenAPI v2 spec to restructure activity-related REST endpoints, introducing .../activities/{activityId}/... routes (e.g. cancel, terminate, outcome, complete/fail/heartbeat) while moving older pause/reset/unpause/update-options routes under an activities-deprecated prefix and adding top-level activity-* worker-style endpoints.

Removes the experimental workflows/execute-multi-operation API from the OpenAPI spec and adjusts several schema definitions/fields (including new namespace capability workerPollCompleteOnShutdown and related enum/fields changes).

Adds a Go-based CI step (cmd/check-path-conflicts) that fails the build when the OpenAPI spec contains ambiguous path patterns (literal vs parameter segment collisions).

Written by Cursor Bugbot for commit 41246e8. This will update automatically on new commits. Configure here.

@yuandrew yuandrew marked this pull request as ready for review February 20, 2026 00:37
@yuandrew yuandrew requested a review from a team as a code owner February 20, 2026 00:37
Copy link
Copy Markdown
Member

@chris-olszewski chris-olszewski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me, but I think we want to keep respecting TEMPORAL_POLL_SHUTDOWN_INTERRUPT_WAIT_MS set by users in the case that worker_poll_complete_on_shutdown isn't supported. Not sure how widely this was advertised, but it did make it into Python release notes

#[cfg(test)]
let poll_shutdown_interrupt_wait = POLL_SHUTDOWN_INTERRUPT.with(|v| *v.borrow());
#[cfg(not(test))]
let poll_shutdown_interrupt_wait =
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be preserved when worker_poll_complete_on_shutdown isn't supported? Maybe even warn if this is set by the user, but won't be used.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah that's a good point, even though our new solution fixes things, we want the old solution for older server versions

@yuandrew yuandrew merged commit 9d678b9 into temporalio:master Feb 23, 2026
33 of 35 checks passed
@yuandrew yuandrew deleted the shutdown-poll-complete branch February 23, 2026 19:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants