RFR: 8366694: Test JdbStopInNotificationThreadTest.java timed out after 60 second [v3]
SendaoYan
syan at openjdk.org
Wed Sep 3 01:57:42 UTC 2025
On Tue, 2 Sep 2025 18:15:48 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:
>> SendaoYan has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
>>
>> - Merge branch 'openjdk:master' into jbs8366694
>> - Use addDebuggeeOptions(-Xmx64) to make test run quickly, instead of add timeout value
>> - 8366694: Test JdbStopInNotificationThreadTest.java timed out after 60 second
>
> test/jdk/com/sun/jdi/lib/jdb/Jdb.java line 80:
>
>> 78: private static final long sleepTime = 1000;
>> 79: // max time to wait for jdb output (in ms)
>> 80: private static final long timeout = Utils.adjustTimeout(120000);
>
> The way this is implemented is unfortunate. Jdb responses should normally be fairly quick. However, in this test the response doesn't happen until 10% of the java heap has been allocated, and I guess that can be slow sometimes. For some reason the test only allocates 8k at a time, and does a 100ms sleep every 1000 allocations. So now because of this one test, all tests need an unnecessary long timeout. I'm not sure of the reason for the sleep, but in general my suggestion would be to speed up how quickly the test gets to the point of 10% of the java heap being in use. I think using a smaller heap would be the best choice here. Updating the main method to the following should work:
>
>
> public static void main(String argv[]) {
> JdbTest test = new JdbStopInNotificationThreadTest();
> test.launchOptions.addVMOptions("-Xmx64m")
> test.run();
> }
>
>
> Possibly 64m is too small. Remember the trigger happens at 10% of that size, so will happen when 6.4m is allocated. Hopefully that isn't until after the debuggee is actually into the memory allocation code and not before. You may need to adjust higher.
Thanks for your suggestions.
It does very pity to make all the jdb tests have long timeout. Use '-Xmx64' to make java heap allocated finish quick is more graceful solution. I have updated to use '-Xmx64' and it works.
Change has been verified localy on linux-x64.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27055#discussion_r2317568271
More information about the serviceability-dev
mailing list