Skip to content

Fix race conditions in polling client communicator Flush and Reset - #631

Merged
copybara-service[bot] merged 1 commit into
masterfrom
cl/949430003
Aug 18, 2026
Merged

Fix race conditions in polling client communicator Flush and Reset#631
copybara-service[bot] merged 1 commit into
masterfrom
cl/949430003

Conversation

@copybara-service

Copy link
Copy Markdown

Fix race conditions in polling client communicator Flush and Reset

Fixes concurrency and synchronization issues in the polling client communicator around Flush() and Reset() while preserving the original scheduling, throttling, and lifecycle
behaviors:

  1. Replaces the single-consumer pollComplete channel with a broadcast channel closure mechanism (pollDone chan struct{}), ensuring multiple concurrent Flush() callers all wake up properly without channel read contention.
  2. Replaces pollDone on Reset() and outbox enqueue to ensure Flush() waits for the appropriate poll cycle.
  3. Differentiates Reset()-induced request cancellations from network failures (wasReset), preserving queued messages for immediate re-poll rather than NACKing them.
  4. Preserves lastActive dynamic latency reduction, oldestUnsent buffer delay tracking, FailureSuicideTimeSeconds suicide timeout, and shutdown flush behavior.

@copybara-service copybara-service Bot added the exported Exported change from internal source label Aug 18, 2026
@copybara-service
copybara-service Bot force-pushed the cl/949430003 branch 2 times, most recently from 7816847 to 0dd7f20 Compare August 18, 2026 15:38
Fixes concurrency and synchronization issues in the polling client communicator around Flush() and Reset() while preserving the original scheduling, throttling, and lifecycle
behaviors:

1. Replaces the single-consumer `pollComplete` channel with a broadcast channel closure mechanism (`pollDone chan struct{}`), ensuring multiple concurrent `Flush()` callers all wake up properly without channel read contention.
2. Replaces `pollDone` on `Reset()` and outbox enqueue to ensure `Flush()` waits for the appropriate poll cycle.
3. Differentiates `Reset()`-induced request cancellations from network failures (`wasReset`), preserving queued messages for immediate re-poll rather than NACKing them.
4. Preserves `lastActive` dynamic latency reduction, `oldestUnsent` buffer delay tracking, `FailureSuicideTimeSeconds` suicide timeout, and shutdown flush behavior.

PiperOrigin-RevId: 966620893
@copybara-service
copybara-service Bot merged commit 7abe4d2 into master Aug 18, 2026
18 checks passed
@copybara-service
copybara-service Bot deleted the cl/949430003 branch August 18, 2026 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

exported Exported change from internal source

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants