Skip to content

Add delay to address flaky fsevent test - #9310

Merged
gridbugs merged 1 commit into
ocaml:mainfrom
gridbugs:fsevent-test-delay
Nov 30, 2023
Merged

gridbugs merged 1 commit into
ocaml:mainfrom
gridbugs:fsevent-test-delay

Conversation

@gridbugs

Copy link
Copy Markdown
Contributor

The test checks that exceptions raised in in event handlers cause the watcher to terminate and the exception is passed to the thread waiting on the watcher. The test is flaky because the watcher is stopped directly after some period of time and there's a race between this and the exception being raised. This change delays stopping the watcher directly so it's practically guaranteed that there will be time for the exception to be raised.

Fixes #9299

@gridbugs
gridbugs requested a review from emillon November 29, 2023 01:57
@gridbugs gridbugs added the macos Issues that relate to Dune on macOS label Nov 29, 2023
@emillon

emillon commented Nov 29, 2023

Copy link
Copy Markdown
Collaborator

Is there a way to trigger the exception at a different time, for example by triggering a GC? (I don't know if that makes sense)

@gridbugs

Copy link
Copy Markdown
Contributor Author

I don't understand this suggestion. The test is testing that exceptions raised by event handlers are returned by wait_until_stopped. How would triggering a GC help here?

@emillon

emillon commented Nov 30, 2023

Copy link
Copy Markdown
Collaborator

nevermind, I was confused about the cause of the race condition.

The test checks that exceptions raised in in event handlers cause the
watcher to terminate and the exception is passed to the thread waiting
on the watcher. The test is flaky because the watcher is stopped
directly after some period of time and there's a race between this and
the exception being raised. This change delays stopping the watcher
directly so it's practically guaranteed that there will be time for the
exception to be raised.

Signed-off-by: Stephen Sherratt <[email protected]>
@gridbugs
gridbugs merged commit 5b3c57a into ocaml:main Nov 30, 2023
@gridbugs
gridbugs deleted the fsevent-test-delay branch November 30, 2023 10:25
@Alizter Alizter added this to the 3.13.0 milestone Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

macos Issues that relate to Dune on macOS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky test in fsevents

3 participants