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

Protect GradleProvisioner.RootProvisioner from a race condition #942

Merged
merged 2 commits into from
Sep 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions plugin-gradle/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ We adhere to the [keepachangelog](https://keepachangelog.com/en/1.0.0/) format (
* `eclipse-jdt` from `4.19` to `4.20`
* `eclipse-wtp` from `4.18` to `4.20`

### Fixed
* Large parallel multiproject builds could sometimes generate hard-to-reproduce errors below (reported in [#941](https://github.com/diffplug/spotless/pull/942), attempted fix in [#942](https://github.com/diffplug/spotless/pull/942)).
* `:spotlessInternalRegisterDependencies task failed.`
* `Cannot add a configuration with name 'spotless-1911100560'`
* Spotless does not [yet](https://github.com/diffplug/spotless/pull/721) support configuration-cache, but now it can never interfere with configuration-cache for other tasks. ([#720](https://github.com/diffplug/spotless/pull/720))

## [5.15.0] - 2021-09-04
### Added
* Added support for `google-java-format`'s `skip-reflowing-long-strings` option ([#929](https://github.com/diffplug/spotless/pull/929))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,23 @@ static class RootProvisioner implements Provisioner {
@Override
public Set<File> provisionWithTransitives(boolean withTransitives, Collection<String> mavenCoordinates) {
Request req = new Request(withTransitives, mavenCoordinates);
Set<File> result = cache.get(req);
Set<File> result;
synchronized (cache) {
result = cache.get(req);
}
if (result != null) {
return result;
} else {
result = GradleProvisioner.fromRootBuildscript(rootProject).provisionWithTransitives(req.withTransitives, req.mavenCoords);
cache.put(req, result);
return result;
synchronized (cache) {
result = cache.get(req);
if (result != null) {
return result;
} else {
result = GradleProvisioner.fromRootBuildscript(rootProject).provisionWithTransitives(req.withTransitives, req.mavenCoords);
cache.put(req, result);
return result;
}
}
}
}
}
Expand Down