RFR(trivial): 8231024: Improve the debug info when the output is truncated

David Holmes david.holmes at oracle.com
Mon Sep 16 06:40:13 UTC 2019


Hi Jie,

On 16/09/2019 3:53 pm, Jie Fu wrote:
> Hi Ioi and David,
> 
> Updated: http://cr.openjdk.java.net/~jiefu/8231024/webrev.01/
>    -1) The printed value has been changed from written + 1 to written + 2;
>    -2) The input buffer size has been printed;
>    -3) Adjust the error message to avoid some misleading.
> 
> - Before the patch
> ------------------------------------
> [2019-09-14 16:07:55,752] Agent[1]: stderr: OpenJDK 64-Bit Server VM 
> warning: increase O_BUFLEN in ostream.hpp -- output truncated
> [2019-09-14 16:07:55,758] Agent[1]: stderr: OpenJDK 64-Bit Server VM 
> warning: increase O_BUFLEN in ostream.hpp -- output truncated
> [2019-09-14 16:07:55,763] Agent[1]: stderr: OpenJDK 64-Bit Server VM 
> warning: increase O_BUFLEN in ostream.hpp -- output truncated
> ...
> ------------------------------------
> 
> - After the patch
> ------------------------------------
> [2019-09-16 13:35:59,351] Agent[1]: stderr: OpenJDK 64-Bit Server VM 
> warning: The buffer size is 2000, which (e.g., O_BUFLEN or BUFLEN) 
> should be increased to 2014 or above -- output truncated
> [2019-09-16 13:35:59,361] Agent[1]: stderr: OpenJDK 64-Bit Server VM 
> warning: The buffer size is 2000, which (e.g., O_BUFLEN or BUFLEN) 
> should be increased to 2032 or above -- output truncated
> [2019-09-16 13:35:59,371] Agent[1]: stderr: OpenJDK 64-Bit Server VM 
> warning: The buffer size is 2000, which (e.g., O_BUFLEN or BUFLEN) 
> should be increased to 2050 or above -- output truncated
> ...
> ------------------------------------

Okay I'm confused. I had assumed that the passed in buffer size must be 
different in each case because of the 2014/2032/2050 values in the 
message, but in fact they are all sized at 2000. That makes no sense - 
how can we have written e.g. 2014 bytes to a buffer of only 2000 bytes? 
Do we have a bug in os::vsnprintf?

Thanks,
David
-----

> Could you please review it and give me some advice?
> 
> Thanks a lot.
> Best regards,
> Jie
> 
> 
> On 2019/9/16 下午12:04, Jie Fu wrote:
>> Hi David,
>>
>> Thank you for your review.
>> Will update the patch soon.
>> Please seem comments inline.
>>
>> Best regards,
>> Jie
>>
>> On 2019/9/15 上午10:03, David Holmes wrote:
>>> Looks good. But given this keeps reporting different values, the 
>>> input buffer size must be different in each case, so printing that 
>>> size as well could also be useful for tracing back to the callsite. 
>>
>> OK. Will do.
>>
>>
>>> There seems to be as assumption that the buffer is always O_BUFLEN in 
>>> size but as it is set to 2000 that can't be the case. In which case 
>>> the error message itself seems somewhat misleading.
>> I agree that the error message itself seems somewhat misleading since 
>> apart from O_BUFLEN [1], BUFLEN [2] may also be used as the buffer size.
>>
>> [1] 
>> http://hg.openjdk.java.net/jdk/jdk/file/24df796eef3d/src/hotspot/share/utilities/ostream.cpp#l124 
>>
>> [2] 
>> http://hg.openjdk.java.net/jdk/jdk/file/24df796eef3d/src/hotspot/share/utilities/xmlstream.cpp#l138 
>>
>>
> 


More information about the hotspot-dev mailing list