RFR: JDK-8257235: [PATCH] InetAddress.isReachable: Try to use an IPPROTO_ICMP socket type before attempting RAW_SOCK [v2]

Conor Cleary ccleary at openjdk.java.net
Fri Feb 19 17:22:53 UTC 2021


On Thu, 18 Feb 2021 10:12:30 GMT, Conor Cleary <ccleary at openjdk.org> wrote:

>>> I think that the changes are mostly good. I would like to try them out on my local system and our internal buildAndTest system.
>> 
>> Chris, were you able to test the patch? 
>> 
>> Also if anyone has an idea as to the best way to unit test this, let me know; are there any other unit tests where the build can become a root user?
>
>> > I think that the changes are mostly good. I would like to try them out on my local system and our internal buildAndTest system.
>> 
>> Chris, were you able to test the patch?
>> 
>> Also if anyone has an idea as to the best way to unit test this, let me know; are there any other unit tests where the build can become a root user?
> 
> Hi @jamieletual, I'm currently investigating any possibilities in testing for this change. In the meantime however it could be good to change the title of the PR to "8257235: InetAddress.isReachable should use non-privileged ICMP sockets when available" as it appears to be an Integration blocker (see Integration Blocker section of first PR comment).

Test failures related to these change are seen in the following areas after tier 1-3 test runs and runs across net & nio packages:
 
**test/jdk/java/net/Inet4Address/PingThis.java (macosx-x64, linux-x64)**
----------System.out:(1/34)----------
localhost/127.0.0.1  is reachable
----------System.err:(12/791)----------
java.lang.RuntimeException: Unexpected exception:java.net.SocketException: Can't assign requested address
	at IsReachableViaLoopbackTest.main(IsReachableViaLoopbackTest.java:36)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:298)
	at java.base/java.lang.Thread.run(Thread.java:831)

**test/jdk/java/net/InetAddress/IsReachableViaLoopbackTest.java (macosx-x64):**
----------System.out:(1/25)----------
The target ip is 0.0.0.0
----------System.err:(16/981)----------
java.net.SocketException: Socket is not connected
	at java.base/java.net.Inet6AddressImpl.isReachable0(Native Method)
	at java.base/java.net.Inet6AddressImpl.isReachable(Inet6AddressImpl.java:94)
	at java.base/java.net.InetAddress.isReachable(InetAddress.java:548)
	at java.base/java.net.InetAddress.isReachable(InetAddress.java:507)
	at PingThis.main(PingThis.java:66)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:298)
	at java.base/java.lang.Thread.run(Thread.java:831)

Both tests call the native isReachable0 and it seems related to the version in Inet6AddressImpl.c

-------------

PR: https://git.openjdk.java.net/jdk/pull/1502


More information about the net-dev mailing list