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
Gradle 6.5 gets stuck in an infinite loop during dependency resolution #13450
Comments
Actually, I figured out how to build a reproducer: https://github.com/cesar1000/infinite-resolution-loop. The setup is somewhat complicated: the build depends on version 0.1.1-SNAPSHOT of the annotation processor, which depends on version 0.1.0-SNAPSHOT. |
Looks like a single configuration causes the infinite loop: I am still trying to make sense of the loop but it seems caused by the project vs. binary selection around |
Yeah, I worked around the issue by skipping that particular configuration. Something to note is that I could only repro with binary dependencies using version |
Prior to this change, in some corner cases, dependency graph building would never terminate, with selection of some modules alternating repeatedly. With these changes, we now ignore selection changes after a high threshold. This prevents unstable graph to loop in resolution for ever. Fixes #13450
That graph is a tough one. I have a tentative fix in #13794. In short, after seeing too many version changes for a single module, we stop and keep the highest. This ends up allowing resolution to finish but a number of features are then degraded, such as alignment. |
Hmm interesting. What does too many version changes mean in this context? Ultimately, it's two versions only, 0.1.0-SNAPSHOT and 0.1.1-SNAPSHOT – but I'm probably oversimplifying :). The dependency pattern is odd indeed, with scythe:common:0.1.1-SNAPSHOT -> scythe:runtime:0.1.0-SNAPSHOT -> scythe:common:0.1.0-SNAPSHOT -> scythe:runtime:0.1.0-SNAPSHOT, but it stabilizes after that. I did notice while setting up the repro that removing 0.1.1-SNAPSHOT from the equation and depending directly on 0.1.0-SNAPSHOT failed to repro. |
I'll try to do a write up of my understanding. For now, could you try updating the wrapper to version
|
Currently, to get that message printed out for a module, its version need to change a 1000 times. And yes it is usually alternating between two versions only for a given module. The reason it does not stabilize has to do with the fact that you cannot have a dependency on a binary version of a dependency that happens to be the project itself. So you effectively have Most importantly, now that you have a result, is it something the project can handle? |
Cool, thanks for the extra detail. The fix does address our issue: the resolution no longer hangs and results in a reasonable version. Out of curiosity, is this an issue in the current implementation that you may be able to address as you continue to refine the resolution mechanism, or is it an unavoidable built-in restriction? |
A project using the same structure as the reproducer for #13329 defines an annotation processor that runs on itself by using binary dependencies. The compilation, test and dependencies tasks work without trouble, but running the following task to force the download of all dependencies (for populating a read-only cache) gets stuck in an infinite loop:
Execution gets stuck consistently in the same set of tasks:
A thread dump contains the following threads:
I placed tracepoints in
DependencyGraphBuilder.traverseGraph()
("Processing Node"),NodeState.visitDependencies()
("Dependency"),ResolveState.onFewerSelected()
("addFirst") andResolveState.onMoreSelected()
("addLast") in order to describe the loop, and this is the output that I got for one single cycle:The issue repros consistently in 6.5. I couldn't figure out a repro, but I'd be happy to collect more information if needed!
The text was updated successfully, but these errors were encountered: