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 #2137 Socket.getifaddrs returns incorrect interface list... #2287

Merged
merged 4 commits into from Jan 12, 2015

Conversation

@gfowley
Copy link
Contributor

@gfowley gfowley commented Dec 7, 2014

Fix #2137 Socket.getifaddrs returns incorrect interface list...

Socket.getifaddrs creates a single packet interface for each IP interface.
Ifaddr and Addrinfo methods behave more like MRI 2.2.0.
Added tests for Ifaddr and Addrinfo.
Need constant AF_PACKET (17) added to .h files - was unable to figure out where to change FFI platform specific files to affect build.
Need to generate packet interface for interfaces with no IP address (platform dependent?).

gfowley added 2 commits Dec 7, 2014
added tests for Ifaddr and Addrinfo
Socket.getifaddrs creates a packet interface for each IP interface
Ifaddr and Addrinfo methods behave more like MRI 2.2.0
Need constant AF_PACKET (17) added to .h files
Need to generate packet interface for interfaces with no IP address (platform dependent?)
@gfowley
Copy link
Contributor Author

@gfowley gfowley commented Dec 8, 2014

Tests pass on my system (linux x86_64).
Travis CI reports java.lang.NullPointerException where test calls Socket.getifaddrs, but no stacktrace for Java. Is there anything I can specify at the test level to get a complete stacktrace ?

[exec] test_getifaddrs: E
[exec] ===============================================================================
[exec] Error: test_getifaddrs(SocketTest)
[exec] : SocketError: getifaddrs: java.lang.NullPointerException
[exec] /home/travis/build/jruby/jruby/test/jruby/test_socket.rb:76:in `test_getifaddrs'
[exec] 73:
[exec] 74: def test_getifaddrs
[exec] 75: begin
[exec] => 76: list = Socket.getifaddrs
[exec] 77: rescue NotImplementedError
[exec] 78: return
[exec] 79: end
[exec] ===============================================================================

In the meantime, commit 7be572e adds Addrinfo and Ifaddr tests to jruby.index, maybe those test results will shed some light.

@gfowley
Copy link
Contributor Author

@gfowley gfowley commented Dec 8, 2014

Nope, no luck there. Tests in Addrinfo and Ifaddr call Socket.getifaddrs to generate objects to test. It fails in the same way without a Java stacktrace.

All these tests pass locally for me under various combinations of network interface configurations. Is there any way to get at that trace to see what's different in Travis CI ?

@headius
Copy link
Member

@headius headius commented Dec 8, 2014

@iqeo That NPE would be easy to investigate if we had access to travis. Thankfully, we can do that. If you email the Travis support email, they can set up an ssh-able instance for you for 24 hours. That should make it easy to reproduce.

Alternatively, you could set up a VM with the same releases of OS and JVM. Thanks for your help on this!

@headius headius added this to the JRuby 9.0.0.0 milestone Dec 8, 2014
gfowley added 2 commits Dec 31, 2014
Deal with null from getHardwareInterface()
Tests permit multiple ipv4 loopbacks
Removed trivial test for Ifaddr.ifindex range, passes in debug VM, fails in build job
@gfowley
Copy link
Contributor Author

@gfowley gfowley commented Dec 31, 2014

All set now. Access to the Travis VM was key to seeing .getHardwareAddress() returned null for their point-to-point interfaces. And a quirky difference with Ifaddr.ifindex between the VM and build job was failing a test in the build job.

@headius
Copy link
Member

@headius headius commented Jan 12, 2015

Great homework on this one, thank you. I'll merge locally to confirm it and then push if it's good.

@headius headius merged commit ff42c47 into jruby:master Jan 12, 2015
1 check passed
1 check passed
continuous-integration/travis-ci The Travis CI build passed
Details
@headius headius self-assigned this Jan 12, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants
You can’t perform that action at this time.