Skip to content

Consume buffered signals once behind an SDK flag - #3191

Open
sangkyoonnam wants to merge 3 commits into
temporalio:mainfrom
sangkyoonnam:fix/buffered-signal-delivery-3189
Open

sangkyoonnam wants to merge 3 commits into
temporalio:mainfrom
sangkyoonnam:fix/buffered-signal-delivery-3189

Conversation

@sangkyoonnam

Copy link
Copy Markdown
Contributor

What changed?

Remove each buffered signal before calling its matching handler, behind CONSUME_BUFFERED_SIGNALS (SDK flag 7). Unmatched signals stay queued. Nested listener registration can consume the remaining signals while another handler is blocked.

The flag starts disabled, following the staged rollout used by SCHEDULE_ASYNC_STUB_OPERATIONS. A later release can enable it for new workflows with tryUseSdkFlag.

Why?

Fixes #3189. Later listener registrations currently deliver buffered signals again, and unrelated registrations can duplicate pending entries. Registering listeners before signals arrive avoids this, but doesn't cover listeners registered during workflow execution.

Validation

I ran the 16 focused tests three times and the 74-test signal and replay suite; all passed. The three regressions fail on the baseline. Recorded histories cover both flag states, and changing the flag produces command mismatches. spotlessApply passed. Tested with Java 21 and the in-memory server.

Breaking changes?

No public API changes. Histories without the flag retain their previous deliveries and command order.

Server PR

None.

@sangkyoonnam
sangkyoonnam requested a review from a team as a code owner November 5, 2026 19:30
@mjameswh mjameswh self-assigned this Nov 20, 2026

This branch has not been deployed

No deployments
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.

Buffered signals are delivered again when another handler is registered

2 participants