The GitHub Actions job "CI" on 
grails-core.git/fix/directory-watcher-fallback-8.0.x has failed.
Run started by GitHub user codeconsole (triggered by codeconsole).

Head commit for run:
5aa26db4c41fb507e738b102cc023c4930599013 / Scott Murphy Heiberg 
<[email protected]>
Fall back to the WatchService watcher instead of polling

DirectoryWatcher probed for JNA to decide whether the native macOS
FSEvents watcher was usable. JNA is not what that watcher needs — it
needs io.methvin:directory-watcher, which grails-bootstrap declares
compileOnly and therefore never puts on an application's runtime
classpath. Applications routinely acquire JNA transitively (Testcontainers
-> docker-java-transport-zerodep -> jna is a common path), so on macOS
they were sent down a load of MacOsWatchServiceDirectoryWatcher that could
not succeed. The resulting NoClassDefFoundError was caught by a single
catch-all that dropped straight to PollingDirectoryWatcher, so those
applications silently polled every directory on a 1s timer instead of
receiving file system events.

The fallback ordering made this worse than having no JNA at all: without
JNA the else branch selected WatchServiceDirectoryWatcher and worked
correctly, so adding an unrelated dependency downgraded file watching.

Probe for io.methvin.watchservice.MacOSXListeningWatchService, the class
that actually backs the native watcher, and degrade in steps — native
macOS, then the JDK WatchService, then polling. Polling is now only
reached if the JDK cannot supply a WatchService, which cannot happen on
the Java 21 baseline; the accompanying message no longer claims Java 6.
Absence of the optional dependency is logged at debug rather than warn
since it is an opt-in performance improvement, not a fault.

DirectoryWatcherSpec covers the three outcomes and fails on the previous
implementation. It needs JNA present and directory-watcher absent to
reproduce the reported shape, so JNA is added to the test runtime.

Report URL: https://github.com/apache/grails-core/actions/runs/30782284251

With regards,
GitHub Actions via GitBox

Reply via email to