gradle icon indicating copy to clipboard operation
gradle copied to clipboard

Filesystem watching breaks with symlinks

Open equeim opened this issue 1 year ago • 7 comments

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

  1. Clone https://github.com/equeim/tremotesf-android
  2. 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

equeim avatar Feb 03 '24 02:02 equeim

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.

ov7a avatar Feb 05 '24 09:02 ov7a

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/

lptr avatar Feb 22 '24 08:02 lptr

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.

equeim avatar Feb 23 '24 00:02 equeim

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.

mboos avatar Mar 20 '24 19:03 mboos

If it helps, I do not see this error on MacOS 14.3 with the same repo, just Linux.

mboos avatar Mar 20 '24 19:03 mboos

If it helps, I do not see this error on MacOS 14.3 with the same repo, just Linux.

Thanks, this is useful indeed.

lptr avatar Mar 25 '24 17:03 lptr

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

kalayda avatar May 18 '24 14:05 kalayda