RFR: 8359827: Test runtime/Thread/ThreadCountLimit.java should run exclusively [v2]

SendaoYan syan at openjdk.org
Tue Jul 22 02:04:24 UTC 2025


On Mon, 21 Jul 2025 21:20:19 GMT, David Holmes <dholmes at openjdk.org> wrote:

> That's not the way ulimit should work in different sub-shells. 

I initially thought that ulimit shouldn't work like that in different sub-shells. But actually ulimit works in different sub-shells as unexpectedly. 
The testcase runtime/Thread/ThreadCountLimit.java attempts to limited the number user processes of 4096 by adding the prefix "bash -c ulimit -u 4096" to start the [child process](https://github.com/openjdk/jdk/blob/master/test/hotspot/jtreg/runtime/Thread/ThreadCountLimit.java#L82), but the actual situation is that ulimit does not work as expected. If this testcase run with other tests simultaneously, the number of threads can created maybe be zero, at least the number always less than 4096, it depends how many user processes has been created in the test machine.

> What is the ulimit in the parent shell? I think the subshells are limited by the parent.

The ulimit in the parent shell is unlimited. The first process "./create-thread" can create 5k threads shows that the parent shell has no limit.

<img width="710" height="287" alt="image" src="https://github.com/user-attachments/assets/27b90b30-7107-4c66-a6bb-4e0fae3a0928" />

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

PR Comment: https://git.openjdk.org/jdk/pull/26401#issuecomment-3100424327


More information about the hotspot-runtime-dev mailing list