Skip to content

Increase FileSystemWatcher test event timeout to 1000ms#125744

Merged
lewing merged 1 commit intodotnet:mainfrom
lewing:fix/fsw-increase-timeout-v2
Mar 19, 2026
Merged

Increase FileSystemWatcher test event timeout to 1000ms#125744
lewing merged 1 commit intodotnet:mainfrom
lewing:fix/fsw-increase-timeout-v2

Conversation

@lewing
Copy link
Member

@lewing lewing commented Mar 18, 2026

Increase WaitForExpectedEventTimeout from 500ms to 1000ms per @tmds suggestion in #125740 (comment).

The inotify refactor (#117148) changed stop/start timing for watches, which can delay event delivery under stress conditions. The 500ms timeout is too tight for jitstress runs on slower hardware (arm32), causing false failures in SymbolicLink tests that are being incorrectly attributed to #103630.

This is a single constant change that affects 94 tests using the default ExpectEvent timeout. It should help distinguish timing issues from functional bugs.

Ref: #125737, #125740

/cc @tmds @adamsitnik @jozkee

The inotify refactor (dotnet#117148) changed stop/start timing for watches,
which can delay event delivery under stress. The 500ms timeout is too
tight for jitstress runs on slower hardware (arm32), causing false
failures in SymbolicLink tests.

Double the timeout from 500ms to 1000ms to better distinguish timing
issues from functional bugs. This affects 94 tests that use the default
ExpectEvent timeout.

Ref: dotnet#125737

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 18, 2026 19:44
@lewing lewing requested review from adamsitnik and tmds March 18, 2026 19:45
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-io
See info in area-owners.md if you want to be subscribed.

Copy link
Contributor

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 increases the default wait timeout used by FileSystemWatcher test utilities to reduce Linux (notably arm32 jitstress) timing-related flakiness after the inotify refactor.

Changes:

  • Increase WaitForExpectedEventTimeout from 500ms to 1000ms in the FileSystemWatcher test base helper.
Comments suppressed due to low confidence (1)

src/libraries/System.IO.FileSystem.Watcher/tests/Utility/FileSystemWatcherTest.cs:28

  • Raising WaitForExpectedEventTimeout will also increase the default wait for negative assertions and fixed sleeps that use this constant (e.g., ExpectNoEvent has a default timeout = WaitForExpectedEventTimeout, and some tests call Thread.Sleep(WaitForExpectedEventTimeout)). That can add ~500ms per such call to successful test runs. Consider keeping WaitForExpectedEventTimeout scoped to expected events only (e.g., change ExpectNoEvent’s default to WaitForUnexpectedEventTimeout, or introduce a separate constant for the longer expected-event wait) so the flakiness fix doesn’t unnecessarily slow the suite.
        public const int WaitForExpectedEventTimeout = 1000;         // ms to wait for an event to happen
        public const int LongWaitTimeout = 50000;                   // ms to wait for an event that takes a longer time than the average operation
        public const int SubsequentExpectedWait = 10;               // ms to wait for checks that occur after the first.
        public const int WaitForExpectedEventTimeout_NoRetry = 3000;// ms to wait for an event that isn't surrounded by a retry.
        public const int WaitForUnexpectedEventTimeout = 150;       // ms to wait for a non-expected event.

You can also share your feedback on Copilot code review. Take the survey.

@lewing lewing requested a review from JulieLeeMSFT March 18, 2026 20:21
Copy link
Member

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

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

LGTM, big thanks for fixing it @lewing !

@lewing lewing enabled auto-merge (squash) March 18, 2026 20:59
@lewing
Copy link
Member Author

lewing commented Mar 19, 2026

/ba-g failures are infrastructure and actively being resolved

@lewing lewing merged commit 0d2f781 into dotnet:main Mar 19, 2026
79 of 92 checks passed
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.

5 participants