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

On Windows, bugfix_jruby_2558.rb breaks plugins using peeraddr with a parameter #3364

Closed
driskell opened this issue Jun 2, 2015 · 5 comments

Comments

@driskell
Copy link
Contributor

driskell commented Jun 2, 2015

wrong number of arguments calling 'peeraddr' (1 for 0)

Following file is the cause:
https://github.com/elastic/logstash/blob/f97c01da0631566e0ec07c9a076286e22a8f43a9/lib/logstash/patches/bugfix_jruby_2558.rb

Seems to be a very old patch that re-implements peeraddr, albeit not allowing any parameter. TCPSocket.peeraddr and UDPSocket.peeraddr have allowed a parameter in MRI since at least 1.9.3 (http://ruby-doc.org/stdlib-1.9.3/libdoc/socket/rdoc/IPSocket.html#method-i-peeraddr), and in JRuby since 1.7.0 (jruby/jruby@d835b3c). This parameter allows reverse lookup to be disabled.
MRI allows :numeric symbol as well as boolean value, but JRuby only supports the boolean value.

However, using either when using Logstash breaks the plugin.

@driskell driskell changed the title On Windows, bugfix_jruby_2558.rb breaks plugins using peeraddr with parameters On Windows, bugfix_jruby_2558.rb breaks plugins using peeraddr with a parameter Jun 2, 2015
@jsvd
Copy link
Member

jsvd commented Jun 2, 2015

Nice catch @driskell, changing the method definition and delegation from:

    def peeraddr
      orig_peeraddr.map do |v|

to

    def peeraddr(*args)
      orig_peeraddr(*args).map do |v|

Seems to address the problem. I'll submit a PR to fix

@Rajeshkumar123
Copy link

I couldn't find RubyIPSocket.java in logstash 1.5.0

@driskell
Copy link
Contributor Author

driskell commented Jun 3, 2015

@Rajeshkumar123 You'll be looking for lib/logstash/patches/bugfix_jruby_2558.rb
(Best to ignore your error trace you had as this file is a special patch that is hidden away and doesn't show in the trace)

See here for the change details:
https://github.com/elastic/logstash/pull/3365/files

@Rajeshkumar123
Copy link

@driskell Awesome Its working fine.

driskell added a commit to driskell/log-courier that referenced this issue Jun 3, 2015
@suyograo
Copy link
Contributor

suyograo commented Jun 4, 2015

Closed #3365

@suyograo suyograo closed this as completed Jun 4, 2015
driskell added a commit to driskell/log-courier that referenced this issue Feb 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants