RFR: 8268361: Fix the infinite loop in next_line [v5]

Thomas Stuefe stuefe at openjdk.java.net
Fri Jun 11 06:12:54 UTC 2021


On Thu, 10 Jun 2021 12:28:37 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.
>
> UncleNine has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR. The pull request contains one new commit since the last revision:
> 
>   8268361: Fix the infinite loop in next_line

Would it not be better to read the whole content of /proc/stat with a single read() call instead of line by line? I don't think proc fs guarantees any kind of consistency with separate reads.

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

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


More information about the serviceability-dev mailing list