Skip to content
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

System.getProperties shouldn't return different map instances #28923

Open
mlopatkin opened this issue Apr 23, 2024 · 1 comment
Open

System.getProperties shouldn't return different map instances #28923

mlopatkin opened this issue Apr 23, 2024 · 1 comment
Labels
a:bug in:configuration-cache Configuration Caching

Comments

@mlopatkin
Copy link
Member

The result of System.getProperties() can be synchronized on. To make it work properly in build scripts, the same instance must be returned each time the method is called. However, the current instrumentation implementation returns different instances each time, making proper synchronization impossible.

Gradle runtime may also access system properties. Such calls aren't instrumented and use the underlying system properties instance. Ideally, they should share the monitor.

@mlopatkin mlopatkin added a:bug in:configuration-cache Configuration Caching and removed to-triage labels Apr 23, 2024
@mlopatkin mlopatkin changed the title System.getProperties return different map instances System.getProperties shouldn't return different map instances Apr 23, 2024
@mlopatkin
Copy link
Member Author

The problem here is that we have consumer variable captured inside the returned instance, which corresponds to the callsite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:bug in:configuration-cache Configuration Caching
Projects
None yet
Development

No branches or pull requests

1 participant