Skip to content

Fix intermittent failures in PAL tests #115958

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 26, 2025
Merged

Fix intermittent failures in PAL tests #115958

merged 1 commit into from
May 26, 2025

Conversation

jkotas
Copy link
Member

@jkotas jkotas commented May 24, 2025

Fixing regression introduced by #115877. The lowres timestamp has a rounding error that makes the test fail intermittently. Switch back to highres timestamp.

@Copilot Copilot AI review requested due to automatic review settings May 24, 2025 05:22
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates several PAL threading tests to use high-resolution tick measurements and converts raw tick deltas into milliseconds to reduce timing-related test flakiness.

  • Replaced minipal_lowres_ticks() with minipal_hires_ticks()
  • Divided tick differences by (minipal_hires_tick_frequency() / 1000) to produce millisecond values
  • Applied these changes consistently across WaitForSingleObject, WaitForMultipleObjectsEx, SleepEx, and Sleep test cases

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/coreclr/pal/tests/palsuite/threading/WaitForSingleObject/WFSOExThreadTest/WFSOExThreadTest.cpp Swap low-res ticks for high-res and convert to ms
src/coreclr/pal/tests/palsuite/threading/WaitForSingleObject/WFSOExSemaphoreTest/WFSOExSemaphoreTest.cpp Swap low-res ticks for high-res and convert to ms
src/coreclr/pal/tests/palsuite/threading/WaitForSingleObject/WFSOExMutexTest/WFSOExMutexTest.cpp Swap low-res ticks for high-res and convert to ms
src/coreclr/pal/tests/palsuite/threading/WaitForMultipleObjectsEx/test2/test2.cpp Swap low-res ticks for high-res and convert to ms
src/coreclr/pal/tests/palsuite/threading/SleepEx/test2/test2.cpp Swap low-res ticks for high-res and convert to ms
src/coreclr/pal/tests/palsuite/threading/SleepEx/test1/test1.cpp Swap low-res ticks for high-res and convert to ms
src/coreclr/pal/tests/palsuite/threading/Sleep/test2/sleep.cpp Swap low-res ticks for high-res and convert to ms
src/coreclr/pal/tests/palsuite/threading/Sleep/test1/Sleep.cpp Swap low-res ticks for high-res and convert to ms

@jkotas
Copy link
Member Author

jkotas commented May 24, 2025

Example of a failure: https://helix.dot.net/api/2019-06-17/jobs/30c36749-2cf4-4fa9-a5bb-71292b5a72a4/workitems/PALTests/console

...................Expected thread to wait for 4000 ms (and not be interrupted).
Thread waited for 3997 ms! (Acceptable delta: 300)

@jkotas
Copy link
Member Author

jkotas commented May 24, 2025

/azp run runtime-coreclr outerloop

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jkotas
Copy link
Member Author

jkotas commented May 24, 2025

cc @huoyaoyuan

Copy link
Member

@AaronRobinsonMSFT AaronRobinsonMSFT left a comment

Choose a reason for hiding this comment

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

Le sigh... Thank you.

@jkotas
Copy link
Member Author

jkotas commented May 26, 2025

/ba-g known issue #115640

@jkotas jkotas merged commit 1548409 into dotnet:main May 26, 2025
142 of 149 checks passed
@jkotas jkotas deleted the pal-tests branch May 26, 2025 00:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants