RFR: 8318302: ThreadCountLimit.java failed with "Native memory allocation (mprotect) failed to protect 16384 bytes for memory to guard stack pages" [v2]

David Holmes dholmes at openjdk.org
Tue Feb 27 05:55:55 UTC 2024


On Thu, 22 Feb 2024 09:13:19 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> David Holmes has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Invert logic to avoid negation.
>
> test/hotspot/jtreg/runtime/Thread/ThreadCountLimit.java line 82:
> 
>> 80:         String java_cmd = ProcessTools.getCommandLine(pb);
>> 81:         // Relaunch the test with args.length > 0, and the ulimit set
>> 82:         ProcessTools.executeCommand("bash", "-c", ULIMIT_CMD + " && " + java_cmd + " dummy")
> 
> I think this assumes `bash` is installed, which is true 99% of the time, but not actually guaranteed. Maybe we should check `if (Platform.isLinux() && new File("/bin/bash").exists())` explicitly.

Doesn't that presume to know where bash is installed? And if it isn't found then should we skip the test due to the risk of failure?

> test/hotspot/jtreg/runtime/Thread/ThreadCountLimit.java line 142:
> 
>> 140:     // Now that all threads have joined, we are away from dangerous
>> 141:     // VM state and have enough memory to perform any other things.
>> 142:     if (!reachedNativeOOM) {
> 
> Cleanup: flip this around to avoid negation in `!reachedNativeOOM`.

Okay. It was an arbitrary choice as to which flag I kept.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17959#discussion_r1503670957
PR Review Comment: https://git.openjdk.org/jdk/pull/17959#discussion_r1503670249


More information about the hotspot-dev mailing list