Nicola Corti
09/16/2024, 10:41 AMVampire
09/16/2024, 9:04 PMAnze Sodja
09/17/2024, 1:41 PM"Immutable workspace contents have been modified" failure when workspace contents are not modified
or about errors like
java.io.UncheckedIOException: Could not move temporary workspace (C:\android\.gradle\8.7\dependencies-accessors\423f0288fa7dffe069445ffa4b72952b4629a15a-8a203d1d-3ff5-4f9d-ad38-d7188fa07baa) to immutable location (C:\android\.gradle\8.7\dependencies-accessors\423f0288fa7dffe069445ffa4b72952b4629a15a)
?
I believe your question is about the latter since it's more common on Windows due to how file locking works. So I will answer for that issue:
> What is the latest know version of Gradle that doesn't ship with the new execution model?
It should be 8.5
> Ultimately, what is the reccomended workaround for users on Windows on Gradle 8.6+, Should we tell them to delete the caches, stop the daemons, or anything else?
Deleting caching will not fix it, since this happens when cache is empty. Once cache has all entries populated there is no more issue. Restarting daemon could help. Normally the main issue is anti-virus or some other process that locks file from moving.
> What's the expected ETA for this fix?
We plan to address it in 8.12. Probably a fix will be to restore 8.5 logic for WindowsNicola Corti
09/19/2024, 9:41 AMCould not move temporary workspace
> What is the latest know version of Gradle that doesn’t ship with the new execution model?
It should be 8.5Are you sure about this? Users on Gradle 8.6 are actually not reporting any issue. Most of the issues are coming from Gradle 8.8 and subsequent versions.
Nicola Corti
09/19/2024, 9:42 AM./gradlew --stop doesn’t seems to really work for users, at least from the report we got 🤔Anze Sodja
09/19/2024, 10:08 AMAnze Sodja
09/23/2024, 9:20 AMNicola Corti
09/24/2024, 10:08 AMIt looks like the issue is that React Native sets the Gradle User home inside the project itselfNope we don’t do that. We use the default Gradle User home
~/.gradle
I guess NodeJs watches whole project directory and thus interacts with Gradle cache filesI’m not 100% sure about this, but I suspect this could be culprit.
Anze Sodja
09/24/2024, 10:19 AMNope we don’t do that. We use the default Gradle User homeThen it must be some tutorial on the web that sets this up. I assumed that since the reporter in https://github.com/facebook/react-native/issues/46210 has the Gradle User Home in:~/.gradle
F:\tutorial-practice\frontend-development\react-native\native-cli-todo-app-2\android\.gradle\
Which looks like project dir.
Also some others seems have it in project dir, e.g. reporter that figured NodeJS blocks Gradle from moving files in gradle/gradle#28475#issuecomment-2365330961 has it in
D:\src\AAAAA.ReactNative_01\apps\DemoApp2\android\.gradleAnze Sodja
09/24/2024, 10:23 AMNicola Corti
09/24/2024, 10:23 AMI assumed that since the reporter in https://github.com/facebook/react-native/issues/46210 has the Gradle User Home in:I don’t think that’s the case. Most of the users are reporting the same exact problem and they’re all on Windows. I’ve never heard of users using a different user home. If you look at the issue on our end: https://github.com/facebook/react-native/issues/46210 The error message is always along the side of:
> java.io.UncheckedIOException: Could not move temporary workspace (F:\tutorial-practice\frontend-development\react-native\native-cli-todo-app-2\android\.gradle\8.8\dependencies-accessors\569c8b261a8a714d7731d5f568e0e5c05babae10-29ae1a11-17a6-474d-825c-7114fe1603d2) to immutable location (F:\tutorial-practice\frontend-development\react-native\native-cli-todo-app-2\android\.gradle\8.8\dependencies-accessors\569c8b261a8a714d7731d5f568e0e5c05babae10)
I’ve just create a fresh project on MacOS, and I also have that path in question:
android/.gradle/8.8/dependencies-accessors/569c8b261a8a714d7731d5f568e0e5c05babae10/Anze Sodja
09/24/2024, 10:24 AMNicola Corti
09/24/2024, 10:44 AMandroid/.gradle
Still I haven’t 100% understood why this has broken from Gradle 8.6+Nicola Corti
09/24/2024, 10:44 AMVampire
09/24/2024, 11:13 AMStill I haven’t 100% understood why this has broken from Gradle 8.6+Because they introduced a new tactic where files are prepared in a temporary location and then are moved to their final location - iirc to reduce lock contention when multiple builds are run at the same time - but on Windows if any process - like Node.js or an AntiVirus - has a lock open on a file, it cannot be moved or deleted. On *nix systems you still can delete or move such files as only their hard-link is deleted but the process having the file open just has a reference to the actual inode of the file.
Nicola Corti
09/24/2024, 12:19 PMAnze Sodja
09/24/2024, 12:45 PMI also can’t reproduce it on my windows machine, which is also really confusingTo reproduce it you will have to delete
android/.gradle (or at least android\.gradle\<gradle-version>\dependencies-accessors) so Gradle will try to re-create these files.Anze Sodja
09/24/2024, 12:46 PMAnze Sodja
09/24/2024, 1:53 PMNicola Corti
09/25/2024, 9:36 AMAnze Sodja
09/25/2024, 9:47 AM