Skip to content

Flaky test: cancel_wakes_a_waiting_reader checks the plan is released before the aborted partition tasks drop it #7677

Open

Description

@dwsmith1983

Describe the bug

handle::tests::cancel_wakes_a_waiting_reader in native/local/src/handle.rs, added in #6883, fails intermittently in the merge queue:

thread 'handle::tests::cancel_wakes_a_waiting_reader' panicked at local/src/handle.rs:214:9:
assertion `left == right` failed
  left: 1
 right: 0

It evicted #7508 (run) on 2026-11-18. #7508 doesn't touch native/local.

cancel() drops the query's stream on the calling thread, which aborts the spawned partition tasks and drops each partition's stream there. An aborted task's future is dropped only later, when a runtime worker picks the task up, and it can still hold the plan: a task that has not run yet still owns its start closure. The test checks refs.strong_count() as soon as the reader sees the cancel, so the check can run before the worker has dropped the task. The crate's other teardown checks (wait_released in tests/execution.rs, the loops in tests/bridge.rs) wait for the count to reach zero under a deadline.

Steps to reproduce

Run cargo test -p datafusion-comet-local --lib handle::tests::cancel_wakes_a_waiting_reader repeatedly. It fails when the worker hasn't dropped the aborted task by the time the assert runs.

Expected behavior

The test should wait, with a deadline, for the strong count to reach zero, like the other teardown checks in the crate.

Activity

  1. dwsmith1983 commented on Nov 18, 2026

    @dwsmith1983
    ContributorAuthor

    take

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions