-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
First configuration to resolve determines effective dynamic version cache policy #3019
Comments
Thanks @DanielThomas for tracking this down. This is a pretty nasty issue, caused by our in-memory resolution cache not respecting the different cache expiry settings for different configurations. I hope to have a fix ready for 4.5. |
Closed
bigdaz
added a commit
that referenced
this issue
Feb 5, 2018
These tests demonstrate that Gradle only considers the cache expiry policy for the first configuration that resolves a particular dynamic version or snapshot module. This is particularly problematic since detached configurations never get any cache expiry configured via `configurations.all`. As such, if a detached configuration is the first to resolve a dynamic version or snapshot during a build invocation, it may cause the user- configured cache expiry to be ignored. Several popular plugins, including the Spring dependency management plugin, add detached configurations that will be resolved early in a build invocation.
bigdaz
added a commit
that referenced
this issue
Feb 5, 2018
In-memory caching of module metadata is done on a per-repository basis: the same repository definition in different projects will allow sharing of in-memory cached module metadata. Component metadata rules are defined on a per-project basis. This means that in the scenario where different component metadata rules have been defined for different projects, only the rules from the first project to resolve a particular module from a particular repository will apply. This fix for this issue will require further changes beyond the fix for #3019.
bigdaz
added a commit
that referenced
this issue
Feb 5, 2018
This fix demonstrates that the incorrect dynamic version behaviour of #3019 is due to the in-memory cache of module version lists. A more complete fix will involve moving the in-memory caching to live with the other filesystem caching, allowing the cache expiry policy to be correctly honoured.
bigdaz
added a commit
that referenced
this issue
Feb 5, 2018
Processing component metadata rules for resolved module metadata is expensive, and the fix for #3019 introduced a serious performance regression. This change adds in-memory caching for the post-processed metadata on a per-repository basis. Unfortunately, this re-introduces the bug #4261, where component metadata rule outputs can leak between projects for a repository. Since defining different metadata rules in different projects is unlikely to be commonplace, this is considered an acceptable interim position. This issue should be addressed with the introduction of general-purpose caching of component metadata rules.
bigdaz
added a commit
that referenced
this issue
Feb 6, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When a dynamic version is first resolved, that version list cached for the duration of the build. However, if the first configuration to resolve doesn't carry the desired
cacheDynamicVersionsFor
setting (as is the case for detached configurations), that will lead to stale dependencies being selected.Expected Behavior
The individual cache TTL is honored.
Current Behavior
The cache TTL of the first configuration to resolve determines the staleness of dynamic dependencies.
Context
When we update dependency locks, we set changing/dynamic caching to
0
, however plugins like Spring Dependency Management use detached configurations as part of dependency resolution, causing that configuration to be ignored.Steps to Reproduce (for bugs)
Build
Run
gw resolve --debug | grep DynamicVersion -A5
against the following build:Observation
Note that the first dynamic version lookup indicates
Using cached module metadata
and the following requests perform no lookup:Your Environment
Gradle 3.5.1
The text was updated successfully, but these errors were encountered: