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

Vyom Tewari vyom.tewari at oracle.com
Fri Jun 23 03:05:41 UTC 2017


Hi Sean,

i  debug the failure and it look like you need to modify your test and 
make it more robust. As Christoph suggested first call 
"getHardwareAddress" and check if is not null then only iterate 100 
time. This way your test will run on any platform and one minor comment 
make your global variables(count&failed ) volatile.

I did the changes at my local env and it did worked for me  and your 
modified test did not failed after fix.

Thanks,

Vyom


On Thursday 22 June 2017 11:46 PM, Seán Coffey wrote:
> Hi Vyom,
>
> thanks for testing. Null is a valid value for some interfaces. I've 
> excluded the loopback interface from being testing. Perhaps there's 
> other issues at play here.  We know that getHardwareAddress() can 
> throw SocketException if I/O fails. For this particular scenario we're 
> not interested in that and perhaps that can be ignored.
>
> I'll take another look.
>
> regards,
> Sean.
>
> On 22/06/2017 18:50, Vyom Tewari wrote:
>> 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