Skip to content

[Bug]: TestDispatchEmptyInputWaitsForRemoteReceiver flaky — dispatch returns before remote receiver attaches #25729

Description

@matrix-meow

Problem

TestDispatchEmptyInputWaitsForRemoteReceiver in pkg/sql/colexec/dispatch/dispatch_test.go:336 fails intermittently:

dispatch_test.go:336: empty dispatch returned before its remote receiver attached

The test verifies that the dispatch operator waits for a remote receiver to attach before returning when input is empty. The dispatch returns prematurely (before receiver attachment), indicating a race condition in the wait logic.

Recent Occurrences

Date PR/Run Job
2026-07-14 PR #25728 UT Test on Ubuntu/x86

Root Cause

Race condition between dispatch returning and remote receiver attachment. Under CI runner scheduling variability, the dispatch goroutine may complete before the receiver goroutine attaches.

Suggested Fix

  1. Add synchronization (channel/WaitGroup) to ensure receiver attachment happens before dispatch checks
  2. Or increase the wait tolerance in the dispatch wait logic
  3. Or make the test deterministic by using explicit synchronization instead of timing

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions