Skip to content

Pub's version resolution goes exponential #1417

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

Closed
mkustermann opened this issue May 23, 2016 · 4 comments
Closed

Pub's version resolution goes exponential #1417

mkustermann opened this issue May 23, 2016 · 4 comments
Labels
closed-duplicate Closed in favor of an existing report

Comments

@mkustermann
Copy link
Member

Similar to Issue 874, I ran into a case where pub upgrade takes forever -- most likely due to pub's constraint solver. The way to reproduce it is to:

# This happens at origin/master == e7ce2a3278cb6d0b631242ac38fab3e17e3c0b74
$ git clone https://github.com/dart-lang/pub-dartlang-dart
$ cd pub-dartlang-dart/app
$ pub upgrade
Resolving dependencies... (7:00s)

I gave up after 7 minutes.

Since fetching pub dependencies worked fine until now there is a solution to the package constraints and pub should be able to discover it.

I can only suspect this started happening after publishing a new version of package:googleapis_auth with changed dependencies on package:crypto.

The version of pub is:

$ pub --version
Pub 1.17.0-dev.3.0

@nex3 Since you made some improvements, which closed Issue 874, I was wondering if you could take a look?

/cc @sgjesse

@nex3
Copy link
Member

nex3 commented May 23, 2016

I'm going to merge this into #912, which despite its name is currently tracking all improvements to the solver. @mkustermann, can you post the pubspec which is causing the exponential explosion in a comment on that issue?

@nex3 nex3 closed this as completed May 23, 2016
@nex3 nex3 added the closed-duplicate Closed in favor of an existing report label May 23, 2016
@mkustermann
Copy link
Member Author

mkustermann commented May 25, 2016

@nex3 It might actually not be the same issue. #912 seems to be about showing a nice message when pub does too much backtracking, I filed this issue because there should be a feasible solution and pub should be able to find it (I understand that the worst-case time complexity of a general constraint solver is exponential, but normal pubspec dependencies have a lot of structure one can exploit during resolution, so maybe the current algorithm could be improved).

I'll leave it up to you to reopen this issue or not.

As you asked, I've attached the pubspec file to the other issue.

@zoechi
Copy link

zoechi commented May 25, 2016

@mkustermann It usually helps to narrow the version constraints (perhaps even to one single possibility). This way you might be able to show that a solution actually exists.

@nex3
Copy link
Member

nex3 commented May 25, 2016

The title of #912 is misleading; it's actually tracking all work on improving the solver, not just making the output better (the two turn out to be very tightly linked).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-duplicate Closed in favor of an existing report
Projects
None yet
Development

No branches or pull requests

3 participants