Skip to content

EM dependency too permissive #324

@ajvondrak

Description

@ajvondrak

I don't think the Ruby version matters here, but just in case:

Last login: Thu May 26 13:15:15 on ttys004
/tmp$ bundle exec ruby -v
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin13]
/tmp$

I've set up a minimal repro in a gist:

/tmp$ git clone [email protected]:e72726e947b1db9387541369ec3b389e.git repro
Cloning into 'repro'...
remote: Counting objects: 12, done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 12 (delta 4), reused 9 (delta 3), pack-reused 0
Receiving objects: 100% (12/12), done.
Resolving deltas: 100% (4/4), done.
Checking connectivity... done.
/tmp$ cd repro
/tmp/repro$

Goliath declares a dependency on eventmachine >= 1.0.0.beta.4. If your Gemfile does not lock to a particular eventmachine version, bundle update (or even your initial bundle install) can wind up installing eventmachine 1.2.0.1 (which, as of this writing is their latest version). This version of EM causes (at the very least) Goliath::TestHelper to fail mysteriously:

/tmp/repro$ bundle update && bundle exec ruby test.rb
Fetching [email protected]:postrank-labs/goliath.git
Fetching gem metadata from https://rubygems.org/..........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies...
Using addressable 2.4.0
Using rack 1.6.4
Using cookiejar 0.3.0
Using einhorn 0.7.1
Using eventmachine 1.2.0.1
Using http_parser.rb 0.6.0
Using git-version-bump 0.15.1
Using log4r 1.1.10
Using multi_json 1.12.1
Using rack-accept-media-types 0.9
Using minitest 5.9.0
Using bundler 1.11.2
Using async-rack 0.5.1
Using em-socksify 0.3.1
Using em-synchrony 1.0.5
Using em-websocket 0.3.8
Using rack-contrib 1.4.0
Using rack-respond_to 0.9.8
Using em-http-request 1.1.3
Using goliath 1.0.4 from [email protected]:postrank-labs/goliath.git (at 1aeb2ae@1aeb2ae)
Bundle updated!
Run options: --seed 32896

# Running:

E

Finished in 0.011878s, 84.1900 runs/s, 0.0000 assertions/s.

  1) Error:
Test#test_reproducing_em_dependency_issue:
RuntimeError: API request failed
    /Users/avondrak/.rvm/gems/ruby-2.3.0/bundler/gems/goliath-1aeb2ae7e6d9/lib/goliath/test_helper.rb:30:in `block in <module:TestHelper>'
    /Users/avondrak/.rvm/gems/ruby-2.3.0/gems/eventmachine-1.2.0.1/lib/em/deferrable.rb:74:in `errback'
    /Users/avondrak/.rvm/gems/ruby-2.3.0/bundler/gems/goliath-1aeb2ae7e6d9/lib/goliath/test_helper.rb:110:in `hookup_request_callbacks'
    /Users/avondrak/.rvm/gems/ruby-2.3.0/bundler/gems/goliath-1aeb2ae7e6d9/lib/goliath/test_helper.rb:131:in `get_request'
    test.rb:10:in `block in test_reproducing_em_dependency_issue'
    /Users/avondrak/.rvm/gems/ruby-2.3.0/bundler/gems/goliath-1aeb2ae7e6d9/lib/goliath/server.rb:105:in `block in start'
    /Users/avondrak/.rvm/gems/ruby-2.3.0/gems/em-synchrony-1.0.5/lib/em-synchrony.rb:39:in `block (2 levels) in synchrony'

1 runs, 0 assertions, 0 failures, 1 errors, 0 skips
/tmp/repro$

I do not know what the bug is, but it seems to have been introduced by EM 1.2.0.1. If I lock the Gemfile to the previously released version, 1.0.9.1, I do not get these errors:

/tmp/repro$ LOCK_EM_VERSION=1 bundle update && bundle exec ruby test.rb
Fetching [email protected]:postrank-labs/goliath.git
Fetching gem metadata from https://rubygems.org/..........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies...
Using addressable 2.4.0
Using rack 1.6.4
Using cookiejar 0.3.0
Using einhorn 0.7.1
Using eventmachine 1.0.9.1 (was 1.2.0.1)
Using http_parser.rb 0.6.0
Using git-version-bump 0.15.1
Using log4r 1.1.10
Using multi_json 1.12.1
Using rack-accept-media-types 0.9
Using minitest 5.9.0
Using bundler 1.11.2
Using async-rack 0.5.1
Using em-socksify 0.3.1
Using em-synchrony 1.0.5
Using em-websocket 0.3.8
Using rack-contrib 1.4.0
Using rack-respond_to 0.9.8
Using em-http-request 1.1.3
Using goliath 1.0.4 from [email protected]:postrank-labs/goliath.git (at 1aeb2ae@1aeb2ae)
Bundle updated!
Run options: --seed 54290

# Running:

.

Finished in 0.010082s, 99.1886 runs/s, 99.1886 assertions/s.

1 runs, 1 assertions, 0 failures, 0 errors, 0 skips
/tmp/repro$

At the very least, Goliath's >= dependency is too permissive. I don't know how to make Goliath compatible with EM 1.2.0.1, but I do know that a recent bundle update on my project has broken basically all of the tests. (Also, I get runtime errors when I don't declare an em-http-request dependency - should this be added explicitly to the Goliath gemspec?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions