RFR: 8268361: Fix the infinite loop in next_line

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


On Sun, 6 Jun 2021 14:47:31 GMT, UncleNine <github.com+1964054+UncleNine at openjdk.org> wrote:

> If the /proc/stat mount point is changed in container environment, the while loop may lead to 100% cpu usage.

Hi,

This fixes the potential infinite loop, but is it sufficient?

Thanks,
David

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 (

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

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


More information about the serviceability-dev mailing list