Skip to content
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

fix argument error when running on ruby 2.5.0 #179

Merged
merged 3 commits into from
Dec 27, 2017

Conversation

tompng
Copy link
Contributor

@tompng tompng commented Dec 26, 2017

related to rails/rails#31517

With ruby 2.5.0 (macOS Sierra), NIO::Selector#select raises ArgumentError

% ruby -v
ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-darwin16]
[1] pry(main)> require 'nio'
=> true
[2] pry(main)> NIO::Selector.new.select
ArgumentError: wrong number of arguments (given 4, expected 0)
from (pry):2:in `lock'
[3] pry(main)> NIO::Selector.new.select
ArgumentError: wrong number of arguments (given 1587058240, expected 0)
from (pry):3:in `lock'
[4] pry(main)> RUBY_VERSION
=> "2.5.0"
[5] pry(main)> NIO::Selector.new.backend
=> :select

Failing tests on ruby 2.5.0

Failures:

  1) NIO acceptables TCPServer behaves like an NIO acceptable selects for read readiness
     Failure/Error: waiting_monitor = selector.register(unacceptable_subject, :r)
     
     ArgumentError:
       wrong number of arguments (given 4, expected 0)
     Shared Example Group: "an NIO acceptable" called from ./spec/nio/acceptables_spec.rb:32
     # ./spec/nio/acceptables_spec.rb:10:in `lock'
     # ./spec/nio/acceptables_spec.rb:10:in `register'
     # ./spec/nio/acceptables_spec.rb:10:in `block (3 levels) in <top (required)>'

  2) NIO::Selector knows which IO objects are registered
     Failure/Error: subject.register(reader, :r)
     
     ArgumentError:
       wrong number of arguments (given 1472809792, expected 0)
     # ./spec/nio/selector_spec.rb:63:in `lock'
     # ./spec/nio/selector_spec.rb:63:in `register'
     # ./spec/nio/selector_spec.rb:63:in `block (2 levels) in <top (required)>'

  3) NIO::Selector closes
     Failure/Error: subject.close
     
     ArgumentError:
       wrong number of arguments (given 1472809808, expected 0)
     # ./spec/nio/selector_spec.rb:214:in `lock'
     # ./spec/nio/selector_spec.rb:214:in `close'
     # ./spec/nio/selector_spec.rb:214:in `block (2 levels) in <top (required)>'

...

Finished in 1.33 seconds (files took 0.66801 seconds to load)
103 examples, 54 failures, 2 pending

changed rb_funcall(recv, mid, 0, 0) to rb_funcall(recv, mid, 0)

@tarcieri
Copy link
Contributor

Thanks. Perhaps try adding Ruby 2.5.0 to .travis.yml too so we can confirm in CI it's fixed? It looks like support for it was merged to rvm yesterday:

rvm/rvm#4265

@tompng
Copy link
Contributor Author

tompng commented Dec 27, 2017

Added 2.5.0

It seems like running tests on 2.5.0 without my rb_funcall patch passes on travis.
https://travis-ci.org/tompng/nio4r/builds/322038078

Maybe the ArgumentError problem occures in only specific OS.

@tarcieri
Copy link
Contributor

Hmm, well as far as I can tell this is more correct, so I'll go ahead and merge it anyway

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants