-
-
Notifications
You must be signed in to change notification settings - Fork 119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Maintaining reference to System.getProperties() in PlatformHelper breaks configuration cache in Gradle 7.4-rc1 #209
Comments
Happy to open simple PR to fix if ok with it |
Oh this one is a little tricky, we're using The majority of which I guess would generally be safe, But judging by the error I think we might need to remove the And I think |
ah ok I won't bother with a PR then, more complex than it appears (as always 😬). My understanding of the problem is that configuration caching essentially serialises objects created during configuration phase and rehydrates them later to skip re-running configuration phase. So any object that is serialised must support certain behaviours and work within some contraints. One of those constraints is not holding references to special objects / objects that will change after rehydration, in this case that is System.getProperties(). You can't hold a reference (and thus serialise) system properties, you have to access it directly otherwise configuration caching will fail like this. You could of course look up the values you need out of system props and store those values directly (and flag them as task and configuration inputs), the problem is the Properties object itself. |
Yeah, though it might not be that difficult to rework it so that we query all these values during configuration but it would involve touching quite a few places (but luckily just a few lines of test code) If you (or anyone else) wants to give it a shot I think |
I'll try a PR, not much else on atm. |
Had a crack, more changes than I wanted but can refine |
3.2.0 is released and this is fixed, thank you for the PR! 🎉 |
I get this error when trying to run
nodeSetup
with--configuration-cache
enabled:Based on https://docs.gradle.org/7.4-rc-1/userguide/configuration_cache.html#config_cache:troubleshooting it appears to be related to maintaining a reference to System.getProperties() that is different across gradle executions, and also has some special wrapping in 7.4+ to auto-detect system property usages.
Not keeping a reference to it and looking it up each time might be the answer? 🤔
The text was updated successfully, but these errors were encountered: