Skip to content

test: make ThreadQueue waits deterministic - #680

Open
Cuiyus wants to merge 1 commit into
alibaba:mainfrom
Cuiyus:fix/thread-queue-flaky-test
Open

test: make ThreadQueue waits deterministic#680
Cuiyus wants to merge 1 commit into
alibaba:mainfrom
Cuiyus:fix/thread-queue-flaky-test

Conversation

@Cuiyus

@Cuiyus Cuiyus commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Replace fixed 20 ms sleeps in ThreadQueue.General and ThreadQueue.MutliThread with condition-variable completion waits.
  • Keep a bounded 10-second timeout so genuine queue stalls fail instead of hanging.
  • Leave the production ThreadQueue API and shutdown behavior unchanged.

Root cause

The weekly RISC-V job failed because ThreadQueue.MutliThread asserted after a fixed 20 ms delay, before all 10,000 queued tasks had completed (8,909 were observed). The neighboring General test used the same timing assumption and had also failed intermittently, so both tests are made deterministic.

Failing job: https://github.com/alibaba/zvec/actions/runs/31197085540/job/92996190189

Validation

  • cmake --build build --target thread_queue_test -j8
  • 100 repeated runs of both affected tests: 200/200 passed
  • ctest --test-dir build -R '^thread_queue_test$' --output-on-failure
  • Repository pre-commit and pre-push hooks: clang-format, gitleaks, conventional commit, and branch-name checks passed

@Cuiyus
Cuiyus marked this pull request as ready for review August 14, 2026 07:10
@Cuiyus
Cuiyus requested a review from iaojnh as a code owner August 14, 2026 07:10
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.

1 participant