RFR : 8182672: Java 8u121 on Linux intermittently returns null for MAC address

Vyom Tewari vyom.tewari at oracle.com
Thu Jun 22 17:50:39 UTC 2017


Hi Sean,

with your patch as well your test case is failing on my 
laptop(Ubuntu16.04), when i tried to run  on jdk8 i am getting below error.

java.net.SocketException: No such device (ioctl(SIOCGIFHWADDR) failed)
     at java.net.NetworkInterface.getMacAddr0(Native Method)
     at 
java.net.NetworkInterface.getHardwareAddress(NetworkInterface.java:457)
     at com.java.test.GetMacAddress.run(GetMacAddress.java:66)
     at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
     at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
     at java.lang.Thread.run(Thread.java:745)
java.net.SocketException: No such device (ioctl(SIOCGIFHWADDR) failed)
     at java.net.NetworkInterface.getMacAddr0(Native Method)
     at 
java.net.NetworkInterface.getHardwareAddress(NetworkInterface.java:457)
     at com.java.test.GetMacAddress.run(GetMacAddress.java:66)
     at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
     at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
     at java.lang.Thread.run(Thread.java:745)
Exception in thread "main" java.lang.RuntimeException: Failed
     at com.java.test.GetMacAddress.main(GetMacAddress.java:96)
mac id is null for interface cscotun0- Thread0
Testing: cscotun0
mac id is null for interface cscotun0- Thread3
Testing: cscotun0

Thanks,

Vyom


On Thursday 22 June 2017 09:59 PM, Seán Coffey wrote:
> JDK 10 fix required to correct a race issue in NetworkInterface. I 
> don't believe the ifreq struct needs to be static in any case. New 
> auto unit testcase also. I propose to skip this fix for JDK 9 and fix 
> in an update release for that family. I also plan to port this to 
> jdk8u-dev.
>
> https://bugs.openjdk.java.net/browse/JDK-8182672
> webrev : http://cr.openjdk.java.net/~coffeys/webrev.8182672.jdk10/webrev/
>
> regards,
> Sean.



More information about the net-dev mailing list