Skip to content

i-slint-live-preview: fix the flaky file watcher tests - #13284

Merged
ogoffart merged 2 commits into
masterfrom
olivier/file-watcher-flaky-test
Sep 8, 2026
Merged

i-slint-live-preview: fix the flaky file watcher tests#13284
ogoffart merged 2 commits into
masterfrom
olivier/file-watcher-flaky-test

Conversation

@ogoffart

@ogoffart ogoffart commented Sep 8, 2026

Copy link
Copy Markdown
Member
  • refreshing_watch_set_stops_forwarding_old_paths hung on CI, likely macOS-only:
    the teardown removed the directory while the watcher was alive, so the watcher
    fell back to watching the shared temp directory, which is very expensive with
    kqueue. Drop the watcher before the directory, which now comes from tempfile.

  • While stress testing this locally on Linux, a different test,
    removing_watched_directory_does_not_report_spurious_errors, failed a few
    times with an EINVAL from inotify_rm_watch: the kernel had already dropped
    the watch of the deleted directory. Treat that error as transient.

When a watched directory is deleted, the kernel drops its inotify
watch on its own. If the reconcile unwatches the directory before
notify has processed the deletion event, inotify_rm_watch fails with
EINVAL, and the error was reported to the user. Reproduced with the
removing_watched_directory_does_not_report_spurious_errors test,
which failed 3 times in 700 runs under CPU load.
When the test root is removed while the watcher is alive, the missing
files resolve to the nearest existing ancestor, the shared temp
directory, and the teardown registers a watch on it. With the kqueue
backend on macOS, notify reacts to writes in a watched directory by
recursively watching the first unknown entry, so every parallel test
creating its root in the temp directory makes the watcher walk
arbitrary trees while the test waits for the worker to finish.

Use tempfile for the test directories. The field order of the test
context drops the watcher before the directory is removed.
@ogoffart
ogoffart merged commit f9363d7 into master Sep 8, 2026
54 checks passed
@ogoffart
ogoffart deleted the olivier/file-watcher-flaky-test branch September 8, 2026 14:59
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