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

UncleNine github.com+1964054+unclenine at openjdk.java.net
Wed Jun 9 14:45:36 UTC 2021


On Wed, 9 Jun 2021 07:29:11 GMT, Severin Gehwolf <sgehwolf at openjdk.org> wrote:

>> I use  top -Hp $PID command and the thread show 100% cpu usage
>> ![top](https://user-images.githubusercontent.com/1964054/121224786-7ad2b180-c8bb-11eb-8c1b-e32b131d4327.png)
>> ![jtack](https://user-images.githubusercontent.com/1964054/121224813-81612900-c8bb-11eb-80e1-29d15989dc17.png)
>
> @UncleNine We should handle the case in the `get_totalticks()` function - which seems to be the only user of `next_line()` - when `next_line()` returns EOF as David said. One way would be to return the 'c' character read in `next_line` and if it's EOF, return -2 in `get_totalticks()`.

all right, i have updated the code

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

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


More information about the serviceability-dev mailing list