Filesystem watching breaks with symlinks
Current Behavior
In my project I have an included build (Gradle plugin) that has a /gradle directory as a symbolic link to root project's parent directory (to reuse wrapper and version catalog without copying them since it's in the same Git repo).
This results in the following warning when running Gradle:
Caught exception: Already watching path: /home/alexey/projects/tremotesf-android/gradle-plugin/gradle
Stopping file watching and invalidating VFS after an error happened
Here is how project's structure looks:
├── app
├── bencode
├── build
├── build.gradle.kts
├── CHANGELOG.md
├── common
├── fastlane
├── gradle
│ ├── libs.versions.toml
│ └── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradle-plugin
│ ├── build.gradle.kts
│ ├── gradle -> ../gradle
│ ├── gradle.properties -> ../gradle.properties
│ ├── gradlew -> ../gradlew
│ ├── gradlew.bat -> ../gradlew.bat
│ ├── settings.gradle.kts
│ └── src
├── gradle.properties
├── gradlew
├── gradlew.bat
├── LICENSES
├── local.properties
├── README.md
├── rpc
├── settings.gradle.kts
└── torrentfile
Expected Behavior
No errors, filesystem watching works.
Context (optional)
No response
Steps to Reproduce
- Clone https://github.com/equeim/tremotesf-android
- Run Gradle
This error does not appear 100% of the time, but very often.
Also, it seems that it tied to configuration cache somehow? I don't see this error when running Gradle with --no-configuration-cache.
Gradle version
8.6
Build scan URL (optional)
No response
Your Environment (optional)
OS: Linux, Fedora 39
Thank you for your interest in Gradle!
This issue needs a decision from the team responsible for that area. They have been informed. Response time may vary.
This should be fixed in 8.7 (RC1 expected on Monday). Could you try reproducing the problem with a nightly version of Gradle? https://gradle.org/release-nightly/
This should be fixed in 8.7 (RC1 expected on Monday). Could you try reproducing the problem with a nightly version of Gradle? https://gradle.org/release-nightly/
Nope, still getting an error (with both nightly and RC1 that was released just now):
Caught exception: Already watching path: /home/alexey/projects/tremotesf-android/gradle-plugin/gradle
Unable to watch the file system for changes. Unable to watch same file twice via different paths: Already watching path: /home/alexey/projects/tremotesf-android/gradle-plugin/gradle.
I'm observing this failure still with 8.7 RC4. In our case, I have the gradle folder symlinked from at least two different locations in my repo.
If it helps, I do not see this error on MacOS 14.3 with the same repo, just Linux.
If it helps, I do not see this error on MacOS 14.3 with the same repo, just Linux.
Thanks, this is useful indeed.
Confirm the problem.
Gradle 8.7 on Windows 11.
The same problem with includeBuild("\\unc\path").
Error while receiving file changes
net.rubygrapefruit.platform.NativeException: Error received when handling events, error = 1: \\unc\path
at net.rubygrapefruit.platform.internal.jni.AbstractNativeFileEventFunctions$NativeFileWatcher.executeRunLoop0(Native Method)
at net.rubygrapefruit.platform.internal.jni.AbstractNativeFileEventFunctions$NativeFileWatcher.executeRunLoop(AbstractNativeFileEventFunctions.java:42)
at net.rubygrapefruit.platform.internal.jni.AbstractFileEventFunctions$AbstractFileWatcher$1.run(AbstractFileEventFunctions.java:154)
Stopping file watching and invalidating VFS after an error happened