Skip to content

Stabilize timer and socket unit tests - #3540

Merged
chenBright merged 2 commits into
apache:masterfrom
wasphin:fix-ci-test-flakes
Sep 14, 2026
Merged

Stabilize timer and socket unit tests#3540
chenBright merged 2 commits into
apache:masterfrom
wasphin:fix-ci-test-flakes

Conversation

@wasphin

@wasphin wasphin commented Sep 13, 2026

Copy link
Copy Markdown
Member

What problem does this PR solve?

Issue Number:

Problem Summary:

Two unit tests can fail under CI load because they rely on tight timing
assumptions. The timer test requires shutdown within 15 milliseconds, and the
socket test releases its socket after a fixed 50-millisecond delay without
ensuring that all asynchronous write callbacks have completed.

What is changed and the side effects?

Changed:

  • Keep the timer shutdown latency check well below the next scheduled task
    while allowing for CI runner scheduling delays.
  • Wait for all shutdown-write callbacks with a bounded countdown event before
    releasing the socket.
  • Stop repeated shutdown-write runs after the first test failure.

Side effects:

  • Performance effects: Normal runs no longer incur the fixed 50-millisecond
    delay in every shutdown-write iteration.
  • Breaking backward compatibility: None.

Check List:

Keep verifying that stop_and_join wakes the timer thread instead of
waiting for future tasks, while allowing for CI runner scheduling delays.
Wait for every write callback before failing and releasing the socket.
Stop repeated runs after the first failure and bound the initial wait.

@chenBright chenBright left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@chenBright
chenBright merged commit e69943b into apache:master Sep 14, 2026
45 of 46 checks passed
@wasphin
wasphin deleted the fix-ci-test-flakes branch September 14, 2026 05:01
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.

2 participants