zombocom/derailed_benchmarks

My rails 4.2.6 project is installing derailed_benchmarks v0.0.0 when using rake >=11

Closed this issue ยท 16 comments

ProGM commented

I just created a new rails 4.2.6 project. After doing setup, I added:

group :development do
  gem 'stackprof'
  gem 'derailed'
end

And I tried to run it, but it fails:

/Users/MYUSER/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/rubygems_integration.rb:355:in `block in replace_bin_path': can't find executable derailed (Gem::Exception)
    from /Users/MYUSER/.rbenv/versions/2.2.3/bin/derailed:23:in `<main>'

I noticed that in my Gemfile.lock says that derailed_benchmarks v0.0.0 is installed. I think that 0.0.0 is not a valid version for this gem.

To solve this, I downgraded to rake 10.5.0, and it seems to work.

I think there's some kind of issue with rake 11+

(in fact I noticed that in your gemspec the definition is: gem.add_dependency "rake", "~> 10")

Could you give me a small example project that reproduces the failure?

ProGM commented

Try create a Gemfile like this:

source 'https://rubygems.org'

ruby '2.3.0'

gem 'rails', '>= 4.2.6'
gem 'rake', '>= 11'

group :development do
  gem 'stackprof'
  gem 'derailed'
end

Try to bundle install

Here's my resulting Gemfile.lock:

GEM
  remote: https://rubygems.org/
  specs:
    actionmailer (4.2.6)
      actionpack (= 4.2.6)
      actionview (= 4.2.6)
      activejob (= 4.2.6)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 1.0, >= 1.0.5)
    actionpack (4.2.6)
      actionview (= 4.2.6)
      activesupport (= 4.2.6)
      rack (~> 1.6)
      rack-test (~> 0.6.2)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    actionview (4.2.6)
      activesupport (= 4.2.6)
      builder (~> 3.1)
      erubis (~> 2.7.0)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    activejob (4.2.6)
      activesupport (= 4.2.6)
      globalid (>= 0.3.0)
    activemodel (4.2.6)
      activesupport (= 4.2.6)
      builder (~> 3.1)
    activerecord (4.2.6)
      activemodel (= 4.2.6)
      activesupport (= 4.2.6)
      arel (~> 6.0)
    activesupport (4.2.6)
      i18n (~> 0.7)
      json (~> 1.7, >= 1.7.7)
      minitest (~> 5.1)
      thread_safe (~> 0.3, >= 0.3.4)
      tzinfo (~> 1.1)
    arel (6.0.3)
    benchmark-ips (2.5.0)
    builder (3.2.2)
    concurrent-ruby (1.0.1)
    derailed (0.1.0)
      derailed_benchmarks
    derailed_benchmarks (0.0.0)
      benchmark-ips (~> 2)
      get_process_mem (~> 0)
      memory_profiler (~> 0)
    erubis (2.7.0)
    get_process_mem (0.2.0)
    globalid (0.3.6)
      activesupport (>= 4.1.0)
    i18n (0.7.0)
    json (1.8.3)
    loofah (2.0.3)
      nokogiri (>= 1.5.9)
    mail (2.6.4)
      mime-types (>= 1.16, < 4)
    memory_profiler (0.9.6)
    mime-types (3.0)
      mime-types-data (~> 3.2015)
    mime-types-data (3.2016.0221)
    mini_portile2 (2.0.0)
    minitest (5.8.4)
    nokogiri (1.6.7.2)
      mini_portile2 (~> 2.0.0.rc2)
    rack (1.6.4)
    rack-test (0.6.3)
      rack (>= 1.0)
    rails (4.2.6)
      actionmailer (= 4.2.6)
      actionpack (= 4.2.6)
      actionview (= 4.2.6)
      activejob (= 4.2.6)
      activemodel (= 4.2.6)
      activerecord (= 4.2.6)
      activesupport (= 4.2.6)
      bundler (>= 1.3.0, < 2.0)
      railties (= 4.2.6)
      sprockets-rails
    rails-deprecated_sanitizer (1.0.3)
      activesupport (>= 4.2.0.alpha)
    rails-dom-testing (1.0.7)
      activesupport (>= 4.2.0.beta, < 5.0)
      nokogiri (~> 1.6.0)
      rails-deprecated_sanitizer (>= 1.0.1)
    rails-html-sanitizer (1.0.3)
      loofah (~> 2.0)
    railties (4.2.6)
      actionpack (= 4.2.6)
      activesupport (= 4.2.6)
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (11.1.1)
    sprockets (3.5.2)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (3.0.4)
      actionpack (>= 4.0)
      activesupport (>= 4.0)
      sprockets (>= 3.0.0)
    stackprof (0.2.8)
    thor (0.19.1)
    thread_safe (0.3.5)
    tzinfo (1.2.2)
      thread_safe (~> 0.1)

PLATFORMS
  ruby

DEPENDENCIES
  derailed
  rails (>= 4.2.6)
  rake (>= 11)
  stackprof

BUNDLED WITH
   1.11.2

As you can see, the derailed_benchmarks is resolved with version 0.0.0

What do you get if you $ gem list | grep derailed_benchmarks

The derailed gem is actually a wrapper I created after the fact https://github.com/schneems/derailed all it does is pull in a dependency to derailed_benchmarks. If you've already got a version installed it will use that version. Instead you can

$ gem install derailed_benchmarks # gives you the latest
$ bundle update derailed_benchmarks # lets your app use the latest
ProGM commented

Output of gem list | grep derailed_benchmarks:

derailed_benchmarks (1.3.0, 0.0.0)

I already tried this:

$ gem install derailed_benchmarks
Successfully installed derailed_benchmarks-1.3.0
Parsing documentation for derailed_benchmarks-1.3.0
Installing ri documentation for derailed_benchmarks-1.3.0
Done installing documentation for derailed_benchmarks after 0 seconds
1 gem installed

$ bundle update derailed_benchmarks
Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies...
Using rake 11.1.1
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.8.4
Using thread_safe 0.3.5
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile2 2.0.0
Using rack 1.6.4
Using mime-types-data 3.2016.0221
Using arel 6.0.3
Using benchmark-ips 2.5.0
Using bundler 1.11.2
Using concurrent-ruby 1.0.1
Using get_process_mem 0.2.0
Using memory_profiler 0.9.6
Using thor 0.19.1
Using stackprof 0.2.8
Using tzinfo 1.2.2
Using nokogiri 1.6.7.2
Using rack-test 0.6.3
Using mime-types 3.0
Using sprockets 3.5.2
Using derailed_benchmarks 0.0.0
Using activesupport 4.2.6
Using loofah 2.0.3
Using mail 2.6.4
Using derailed 0.1.0
Using rails-deprecated_sanitizer 1.0.3
Using globalid 0.3.6
Using activemodel 4.2.6
Using rails-html-sanitizer 1.0.3
Using rails-dom-testing 1.0.7
Using activejob 4.2.6
Using activerecord 4.2.6
Using actionview 4.2.6
Using actionpack 4.2.6
Using actionmailer 4.2.6
Using railties 4.2.6
Using sprockets-rails 3.0.4
Using rails 4.2.6
Bundle updated!

No changes. Gemfile.lock is still the same, the error is still there.

The only way to fix this, as I said in the first post, is to change the gemfile like this:

source 'https://rubygems.org'

ruby '2.3.0'

gem 'rails', '>= 4.2.6'
gem 'rake', '< 11'

group :development do
  gem 'stackprof'
  gem 'derailed'
end

Weird, what happens if you uninstall 0.0.0

$ gem uninstall derailed_benchmarks
ProGM commented

It keeps reinstalling it. ๐Ÿ˜ž

$ gem uninstall derailed_benchmarks

Select gem to uninstall:
 1. derailed_benchmarks-0.0.0
 2. derailed_benchmarks-1.3.0
 3. All versions
> 1
Successfully uninstalled derailed_benchmarks-0.0.0
$ bundle update derailed_benchmarks
Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies...
Using rake 11.1.1
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.8.4
Using thread_safe 0.3.5
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile2 2.0.0
Using rack 1.6.4
Using mime-types-data 3.2016.0221
Using arel 6.0.3
Using benchmark-ips 2.5.0
Using bundler 1.11.2
Using concurrent-ruby 1.0.1
Using get_process_mem 0.2.0
Using memory_profiler 0.9.6
Using thor 0.19.1
Using stackprof 0.2.8
Using tzinfo 1.2.2
Using nokogiri 1.6.7.2
Using rack-test 0.6.3
Using mime-types 3.0
Using sprockets 3.5.2
Installing derailed_benchmarks 0.0.0
Using activesupport 4.2.6
Using loofah 2.0.3
Using mail 2.6.4
Using derailed 0.1.0
Using rails-deprecated_sanitizer 1.0.3
Using globalid 0.3.6
Using activemodel 4.2.6
Using rails-html-sanitizer 1.0.3
Using rails-dom-testing 1.0.7
Using activejob 4.2.6
Using activerecord 4.2.6
Using actionview 4.2.6
Using actionpack 4.2.6
Using actionmailer 4.2.6
Using railties 4.2.6
Using sprockets-rails 3.0.4
Using rails 4.2.6
Bundle updated!
ProGM commented

I think the problem is something with rubygems versions.

The 1.3.0 has rake as dipendence, and it's declared with rake ~> 10
https://rubygems.org/gems/derailed_benchmarks/versions/1.3.0

But 0.0.0 version have no dipendence with rake.
https://rubygems.org/gems/derailed_benchmarks/versions/0.0.0

So, that one is chosen as my version of rake is 11+

Sorry, i see the problem. We're locked to version 10 at the latest, the version 0.0.0 didn't have that restriction.

I updated the gemspec which installs fine for me 765bf9d. Can you try out master

gem "derailed_benchmarks", github: "schneems/derailed_benchmarks"
jmay commented

Same problem, on Rails 4.2.5

Bundler could not find compatible versions for gem "rake":
  In snapshot (Gemfile.lock):
    rake (= 11.1.1)

  In Gemfile:
    derailed_benchmarks (~> 1.1.3) was resolved to 1.1.3, which depends on
      rake (~> 10)

If I force the older rake version in my Gemfile with gem 'rake', '~> 10' then things seem to work, but is there a reason for this not to work with the latest?

jmay commented

Ooo, real-time fix from author! Thanks @schneems

Master seems to be working fine. No errors on bundle exec derailed bundle:mem

ProGM commented

Great, it's working! ;) Thanks!

Cut a release you can now use 1.3.1 with rake 11 up to rake 12

ProGM commented

๐Ÿ‘

Same problem for me right now on rake 12, fwiw.

use master

Yeah just did. thx.