RFR 8179905: Remove the use of gettimeofday in Networking code

Michael McMahon michael.x.mcmahon at oracle.com
Wed May 10 09:22:44 UTC 2017


Yes, I think the only public API that uses a long timeout value is the 
NIO Selector class
and this doesn't use NET_Timeout() in its implementation.

- Michael

On 10/05/2017, 09:53, Claes Redestad wrote:
> Hi,
>
> yes, when we do int -> jlong conversion before multiplication is fine, 
> but there are some methods, such as NET_Timeout that takes long 
> timeout that seemed in danger.
>
> After offline discussion it seems these are always called with what's 
> essentially an int thus we should be safe, but as a follow-up I 
> suggest narrowing to int or jint in such method signatures just to 
> make this clear.
>
> Thanks!
>
> /Claes
>
> On 2017-05-10 08:28, Vyom Tewari wrote:
>> Hi Claes,
>>
>> thanks for review, timeout is "int" so even if you set 
>> max(2147483647) value that int data type can hold, there will not be 
>> any overflow. If you try to set very large number like 
>> "0x7fffffffffffffff" to int data type you will get compile time 
>> error(integer number too large: 7fffffffffffffff).
>>
>> Thanks,
>> Vyom
>>
>> On Tuesday 09 May 2017 11:20 PM, Claes Redestad wrote:
>>> Hi,
>>>
>>> doesn't this need to consider numerical overflows, e.g., what 
>>> happens if someone sets a timeout value near 0x7fffffffffffffffL 
>>> before and after this change?
>>>
>>> /Claes
>>>
>>> On 2017-05-09 11:55, Vyom Tewari wrote:
>>>> Hi ,
>>>>
>>>> Please review the code change for below issue.
>>>>
>>>> Webrev  : 
>>>> http://cr.openjdk.java.net/~vtewari/8179905/webrev0.0/index.html
>>>>
>>>> BugId     : https://bugs.openjdk.java.net/browse/JDK-8179905
>>>>
>>>> This issue is duplicate of "JDK-8165437", where pushed code change 
>>>> failed on 32 bit platforms so we revert back code changes as part 
>>>> of "JDK-8179602".
>>>>
>>>> Please find below is the webrev that was pushed as part of 
>>>> "JDK-8165437".
>>>>
>>>> Webrev  : 
>>>> http://cr.openjdk.java.net/~vtewari/8165437/webrev0.7/index.html
>>>>
>>>> Thanks,
>>>>
>>>> Vyom
>>>>
>>>
>>
>


More information about the net-dev mailing list