RFR[10]: JDK-8023649 - java.net.NetworkInterface.getInterfaceAddresses() call flow clean up
Mark Sheppard
mark.sheppard at oracle.com
Wed Sep 13 11:34:53 UTC 2017
Hi Vyom,
thanks for the feedback ... interesting question and at a more
general level is it safe to release a local reference
if there is a pending exception ...looking at the logic in getByName0
function, it would appear that it is possible
to release the name_utf reference before the createNetworkInterface call
and avoid any potential pending exception
regards
Mark
On 13/09/2017 04:16, vyom tewari wrote:
> Hi Mark,
>
> Thanks for doing this, i see that "createNetworkInterface" method is
> getting called from multiple places in NetworkInterface.c there is
> pending JNI Exception at line 695 in NetworkInterface.c. I am not sure
> if it is safe to call "(*env)->ReleaseStringUTFChars" even if there is
> pending JNI Exception.
>
> Thanks,
>
> Vyom
>
>
> On Tuesday 12 September 2017 10:50 PM, Mark Sheppard wrote:
>> Hi,
>> please oblige and review the follows changes:
>> http://cr.openjdk.java.net/~msheppar/8023649/webrev/
>>
>> for the issue:
>> https://bugs.openjdk.java.net/browse/JDK-8023649
>>
>> This is performed under the auspices of reliability, robustness and
>> stability.
>> * As such, a number of error checks are amended to free malloc-ed
>> memory,
>> * to add consistency to the code, additional ExceptionCheck have been
>> added as a post SetObjectArrayElement invocation check,
>> * A long standing issue reporting that
>> NetworkInterface::getInterfacesAddresses can throw an NPE has been
>> addressed.
>> The context for such a failure is that there is an IPv4 only
>> configuration and that configuration is incorrect in its setting.
>> This may lead to the bindings array being allocated, but expected
>> InterfaceAddress objects not allocated
>> and set in the array .... so the bindings array implicitly contains
>> null references.
>>
>> In NetworkInterface.c the function
>> createNetworkInterface
>> performs a check on an address mask which may lead to skipping the
>> code block handling the InterfaceAddress allocation.
>>
>> regards
>> Mark
>
More information about the net-dev
mailing list