After upgrading JRuby to 9.2.12.0 in Logstash, our CI testing is showing failures in windows
00:43:56 Failure/Error: expect { subject.run }.to raise_error(Errno::EADDRINUSE, /Logstash tried to bind to port range/)
00:43:56
00:43:56 expected Errno::EADDRINUSE with message matching /Logstash tried to bind to port range/, got #<SystemCallError: Unknown error (SystemCallError) - bind(2) for "127.0.0.1" port 10000> with backtrace:
00:43:56 # A:/vendor/bundle/jruby/2.5.0/gems/puma-4.3.5-java/lib/puma/binder.rb:229:in `add_tcp_listener'
00:43:56 # A:/logstash-core/lib/logstash/webserver.rb:104:in `start_webserver'
00:43:56 # A:/logstash-core/lib/logstash/webserver.rb:60:in `block in run'
00:43:56 # A:/logstash-core/lib/logstash/webserver.rb:55:in `run'
00:43:56 # A:/logstash-core/spec/logstash/webserver_spec.rb:137:in `block in <main>'
Maybe related to: https://github.com/jruby/jruby/commit/55d1b31017f34570e18dd6abf24f7f2d61f730c1
Yeah pretty much definitely related to that commit.
Any easy way to reproduce this?
I have a change that will fall back on the old behavior if it's not able to find a matching BindException message. That should fix this, but I can't reproduce here. Perhaps you could PR a test that exercises this?
Also, I think it would be a good idea if we set up a Logstash CI job in JRuby.
@jsvd I've merged #6328 but I'd really like to get confirmation that it's working. It will be in JRuby 9.2.13 very soon.
@headius thanks for the quick fix. I'll setup a windows machine today, test the change and report asap.
Also, I think it would be a good idea if we set up a Logstash CI job in JRuby.
That'd be great!
In logstash we have a compatibility phase in our CI that runs a suite of tests (around 20 min) on multiple *nix and windows.
I'll bring this topic to the team to find out what's the setup we should have. In one way we want to test head jruby against head logstash, but we'll want to avoid causing jruby ci to fail due to our head being unstable.
I confirm the patch fixes the issue on windows. Here's a one liner that reproed the issue:
jruby-9.2.12.0:
C:\logstash\logstash-7.9.0>vendor\jruby\bin\jruby -rsocket -e "2.times { TCPServer.new('127.0.0.1', 4444) }"
2020-07-17T14:20:31.578Z [main] WARN FilenoUtil : Native subprocess control requires open access to the JDK IO subsystem
Pass '--add-opens java.base/sun.nio.ch=org.jruby.dist --add-opens java.base/java.io=org.jruby.dist' to enable.
SystemCallError: Unknown error (SystemCallError) - bind(2) for "127.0.0.1" port 4444
initialize at org/jruby/ext/socket/RubyTCPServer.java:131
new at org/jruby/RubyIO.java:876
-e at -e:1
<main> at -e:1
vs jruby 9.2.12.0 + f13cf68
C:\logstash\logstash-master>vendor\jruby\bin\jruby -rsocket -e "2.times { TCPServer.new('127.0.0.1', 4444) }"
2020-07-17T14:23:12.126Z [main] WARN FilenoUtil : Native subprocess control requires open access to the JDK IO subsystem
Pass '--add-opens java.base/sun.nio.ch=org.jruby.dist --add-opens java.base/java.io=org.jruby.dist' to enable.
Errno::EADDRINUSE: Address already in use - bind - Address already in use: bindbind(2) for "127.0.0.1" port 4444
initialize at org/jruby/ext/socket/RubyTCPServer.java:131
new at org/jruby/RubyIO.java:876
-e at -e:1
<main> at -e:1
Most helpful comment
I confirm the patch fixes the issue on windows. Here's a one liner that reproed the issue:
jruby-9.2.12.0:
vs jruby 9.2.12.0 + f13cf68