Cabal: Solver needs around 20000 backjumps to solve for servant-mock-0.8.3

Created on 26 Dec 2017  路  3Comments  路  Source: haskell/cabal

With GHC-7.8.4 or GHC-7.10.3 and

--index-state='2017-12-25T17:31:19Z'

This is probably due recently released ansi-terminal-0.8, which is quite early in the dependency-graph:

dependency-graph.pdf with ansi-terminal revdeps highlighted

cc @grayjay you might like to solve this puzzle!

solver bug

Most helpful comment

Does this issue require --enable-tests? I was able to produce a failure by checking out version 0.8.3 of servant-mock and running this command:

cabal new-build --dry-run --index-state='2017-12-25T17:31:19Z' --enable-tests --max-backjumps=20000

I think that the conflict between ansi-wl-pprint and the new version of ansi-terminal is the problem. The solver chooses ansi-terminal first and then chooses ansi-wl-pprint after following a chain of dependencies (servant-server, wai-app-static, optparse-applicative, ansi-wl-pprint). Here is a common pattern from the log:

[181] trying: servant-server-0.12 (dependency of servant-mock)
[182] trying: servant-server:setup.base~>base-4.8.2.0/installed-0d6... (dependency of servant-server)
[183] trying: wai-app-static-3.1.6.1 (dependency of servant-server)
[184] trying: optparse-applicative-0.14.0.0 (dependency of wai-app-static)
[185] next goal: ansi-wl-pprint (dependency of optparse-applicative)
[185] rejecting: ansi-wl-pprint-0.6.8.1 (conflict: ansi-terminal==0.8, ansi-wl-pprint => ansi-terminal>=0.4.0 && <0.8)
[185] rejecting: ansi-wl-pprint-0.6.8, ansi-wl-pprint-0.6.7.3, ansi-wl-pprint-0.6.7.2, ansi-wl-pprint-0.6.7.1, ansi-wl-pprint-0.6.7, ansi-wl-pprint-0.6.6 (conflict: ansi-terminal==0.8, ansi-wl-pprint => ansi-terminal>=0.4.0 && <0.7)
[185] rejecting: ansi-wl-pprint-0.6.4, ansi-wl-pprint-0.6.3, ansi-wl-pprint-0.6.2, ansi-wl-pprint-0.6.1, ansi-wl-pprint-0.5.1, ansi-wl-pprint-0.5.0, ansi-wl-pprint-0.4.0, ansi-wl-pprint-0.3.1, ansi-wl-pprint-0.3.0, ansi-wl-pprint-0.2, ansi-wl-pprint-0.1 (conflict: optparse-applicative => ansi-wl-pprint>=0.6.6 && <0.7)
[185] fail (backjumping, conflict set: ansi-terminal, ansi-wl-pprint, optparse-applicative)

The solver tries many combinations of versions for the four packages but can't resolve the conflict until it backtracks to ansi-terminal.

I started working on #4805 to help with conflicts involving packages that are deep in the dependency graph, so I rebased it onto master and tried it with servant-mock. It finished in about 2.6 seconds, so I think that was the only problem. I'd like to fix the remaining issues with the branch and make a PR, though I'm not sure when I'll have time.

All 3 comments

Does this issue require --enable-tests? I was able to produce a failure by checking out version 0.8.3 of servant-mock and running this command:

cabal new-build --dry-run --index-state='2017-12-25T17:31:19Z' --enable-tests --max-backjumps=20000

I think that the conflict between ansi-wl-pprint and the new version of ansi-terminal is the problem. The solver chooses ansi-terminal first and then chooses ansi-wl-pprint after following a chain of dependencies (servant-server, wai-app-static, optparse-applicative, ansi-wl-pprint). Here is a common pattern from the log:

[181] trying: servant-server-0.12 (dependency of servant-mock)
[182] trying: servant-server:setup.base~>base-4.8.2.0/installed-0d6... (dependency of servant-server)
[183] trying: wai-app-static-3.1.6.1 (dependency of servant-server)
[184] trying: optparse-applicative-0.14.0.0 (dependency of wai-app-static)
[185] next goal: ansi-wl-pprint (dependency of optparse-applicative)
[185] rejecting: ansi-wl-pprint-0.6.8.1 (conflict: ansi-terminal==0.8, ansi-wl-pprint => ansi-terminal>=0.4.0 && <0.8)
[185] rejecting: ansi-wl-pprint-0.6.8, ansi-wl-pprint-0.6.7.3, ansi-wl-pprint-0.6.7.2, ansi-wl-pprint-0.6.7.1, ansi-wl-pprint-0.6.7, ansi-wl-pprint-0.6.6 (conflict: ansi-terminal==0.8, ansi-wl-pprint => ansi-terminal>=0.4.0 && <0.7)
[185] rejecting: ansi-wl-pprint-0.6.4, ansi-wl-pprint-0.6.3, ansi-wl-pprint-0.6.2, ansi-wl-pprint-0.6.1, ansi-wl-pprint-0.5.1, ansi-wl-pprint-0.5.0, ansi-wl-pprint-0.4.0, ansi-wl-pprint-0.3.1, ansi-wl-pprint-0.3.0, ansi-wl-pprint-0.2, ansi-wl-pprint-0.1 (conflict: optparse-applicative => ansi-wl-pprint>=0.6.6 && <0.7)
[185] fail (backjumping, conflict set: ansi-terminal, ansi-wl-pprint, optparse-applicative)

The solver tries many combinations of versions for the four packages but can't resolve the conflict until it backtracks to ansi-terminal.

I started working on #4805 to help with conflicts involving packages that are deep in the dependency graph, so I rebased it onto master and tried it with servant-mock. It finished in about 2.6 seconds, so I think that was the only problem. I'd like to fix the remaining issues with the branch and make a PR, though I'm not sure when I'll have time.

@grayjay great! yes, IIRC --enable-tests was needed

This issue should be fixed by #5918.

Was this page helpful?
0 / 5 - 0 ratings