gradle/native-platform

Handle renaming a watched directory on Linux

Opened this issue · 4 comments

wolfs commented

Linux sends the 0x800 event (IN_MOVE_SELF), when renaming a watched directory. Currently, we treat that event as an unknown event. We could handle it as well as REMOVED/CREATED.

See this test:

def "can rename watched directory"() {
given:
def watchedDirectory = new File(rootDir, "watched")
watchedDirectory.mkdirs()
startWatcher(watchedDirectory)
when:
watchedDirectory.renameTo(new File(rootDir, "newWatched"))
waitForChangeEventLatency()
then:
if (Platform.current().linux) {
expectLogMessage(WARNING, Pattern.compile("Unknown event 0x800 for ${Pattern.quote(watchedDirectory.absolutePath)}"))
}
noExceptionThrown()
}

lptr commented

Is this still a problem? I think we've solved it, but not sure.

wolfs commented

I don't think we addressed this.

So what happens is that we drop the VFS when the watched directory is renamed, because we receive an unknown event. I think this is fine.

This error still occurs with Gradle 7.4.2

Unknown event 0x800 for /home/ubuntu/workspace/
Received unknown event for /home/ubuntu/workspace/
Stopping file watching and invalidating VFS after an error happened
Daemon will be stopped at the end of the build after the daemon was no longer found in the daemon registry

And still with Gradle 8.2.1:

Unknown event 0x800 for /build/generated/source/proto/main/python/payment
Unknown event 0x800 for /build/generated/source/proto/main/python/order
Unknown event 0x800 for /build/generated/source/proto/main/python/shared
Received unknown event for /build/generated/source/proto/main/python/payment

BUILD SUCCESSFUL in 1s
1 actionable task: 1 executed

My gradle details:

------------------------------------------------------------
Gradle 8.2.1
------------------------------------------------------------

Build time:   2023-07-10 12:12:35 UTC
Revision:     a38ec64d3c4612da9083cc506a1ccb212afeecaa

Kotlin:       1.8.20
Groovy:       3.0.17
Ant:          Apache Ant(TM) version 1.10.13 compiled on January 4 2023
JVM:          17.0.6 (Eclipse Adoptium 17.0.6+10)
OS:           Linux 6.2.0-26-generic amd64