RFR: 8268361: Fix the infinite loop in next_line

David Holmes dholmes at openjdk.java.net
Tue Jun 8 06:43:15 UTC 2021


On Tue, 8 Jun 2021 06:35:59 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> If the /proc/stat mount point is changed in container environment, the while loop may lead to 100% cpu usage.
>
> src/jdk.management/linux/native/libmanagement_ext/UnixOperatingSystem.c line 70:
> 
>> 68:     do {
>> 69:         c = fgetc(f);
>> 70:     } while(c != '\n' && c != EOF);
> 
> Style nit: please add space before (

It is not obvious to me that the caller of next_line will handle the fact that we have hit EOF?

-------------

PR: https://git.openjdk.java.net/jdk/pull/4378


More information about the serviceability-dev mailing list