applicationsonline / librarian

Librarian - A Framework for Bundlers. Librarian-Chef is at: https://github.com/applicationsonline/librarian-chef.
http://applicationsonline.com/
MIT License
655 stars 71 forks source link

Librarian exhibits degenerate conflict resolution behavior #175

Open willglynn opened 9 years ago

willglynn commented 9 years ago

Consider the following Cheffile, adapted from a real one found in the wild:

site 'https://supermarket.getchef.com/api/v1'

cookbook 'apache2'
cookbook 'apt'
cookbook 'build-essential'
cookbook 'chef_gem'
cookbook 'chef_handler'
cookbook 'chef-client'
cookbook 'cron'
cookbook 'database'
cookbook 'logrotate'
cookbook 'java'
cookbook 'jenkins'
cookbook 'iptables-ng'
cookbook 'memcached'
cookbook 'mysql', '2.0.2'

librarian-chef install takes forever – over 20 hours of CPU time on the original Cheffile so far – without success. Adding --verbose shows why: some version of something depends on mysql >= 5.0.0 which conflicts with the mysql 2.0.2 specified in the Cheffile. librarian-chef starts backtracking appropriately, but it doesn't notice the conflict until well after the cookbook with the mysql >= 5.0.0 dependency, so the resulting search space is huge. Here's a gist of the first million lines of search output.

(Spoiler: turns out it's recent versions of database adding the conflicting dependency. 2.0.0 works fine, so it should only have to backtrack a few releases, but instead it backtracks through the entire version history of several other cookbooks first, going forwards through all the other dependencies again each time.)

There are several ways to address this. I'm preparing a pull request with my fix.

mkropat commented 9 years ago

Dang, I ran into this too with the wordpress cookbook. I attempted to try the fix in #177 but I couldn't get librarian-chef install to run at all for some reason after that, sorry. My workaround for now is to switch to Berkshelf.