RFR: 8339487: ProcessHandleImpl native exceptions - include message text and last error information [v3]
Matthias Baesken
mbaesken at openjdk.org
Fri Sep 6 08:17:51 UTC 2024
On Fri, 6 Sep 2024 07:55:34 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> Matthias Baesken has updated the pull request incrementally with one additional commit since the last revision:
>>
>> check for ENOMEM
>
> src/java.base/macosx/native/libjava/ProcessHandleImpl_macosx.c line 128:
>
>> 126: if (errsysctl < 0) {
>> 127: JNU_ThrowByNameWithMessageAndLastError(env,
>> 128: "java/lang/RuntimeException", "sysctl failed to get info about all processes");
>
> sysctl(3) documents the return as 0 or -1. So maybe better if the while condition checks errsysctl == -1 and the if condition checks errsysctl != 0. Otherwise I think this looks good and will be interesting to see if you have other sightings due to other errors.
>
> I guess we should change the JBS/PR title to make it clearer that this issue is now about handling ENOMEM when the number of processes increases. We'll also need to create another issue for the RuntimeException throwing as that will need updates to the ProcessHandle to specify possible error/exceptions.
Hi Alan, at a lot (but not all) of places ( ProcessHandleImpl_macosx.c , also os_bsd.cpp) we test the sysctl result for < 0; maybe there was a good reason for this ?
Regarding changing the JBS title- yes sure the old title is not really good any more .
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20839#discussion_r1746693340
More information about the core-libs-dev
mailing list