RFR: 8294370: Fix allocation bug in java_lang_Thread::async_get_stack_trace()

Patricio Chilano Mateo pchilanomate at openjdk.org
Mon Sep 26 15:40:56 UTC 2022


Please review this small fix in async_get_stack_trace(). The GrowableArrays created to store the bci and Method* of each frame found while traversing the stack are allocated in the resource area of the thread that calls async_get_stack_trace(). But if the handshake is executed by the target and if the number of frames in the stack exceeds the initial size of the GrowableArrays then we will hit an assertion when trying to grow the size of the arrays (see bug description).
Currently we don't see any issues because the initial size of the GrowableArrays is 512 and our tests don't test beyond that (the maximum value of DEPTH in the vmTestbase/nsk/stress/strace/ tests is 500). The issue can be easily reproduced by either decreasing the initial size of the GrowableArrays or by increasing the value of DEPTH in those strace tests.
To fix it I allocated the arrays in the C heap instead. Also I lowered the initial size of the arrays since 512 seemed too much to start with.
Tested it by running all tests in the vmTestbase/nsk/stress/strace/ directory.

Thanks,
Patricio

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

Commit messages:
 - v1

Changes: https://git.openjdk.org/jdk/pull/10424/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=10424&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8294370
  Stats: 11 lines in 1 file changed: 6 ins; 0 del; 5 mod
  Patch: https://git.openjdk.org/jdk/pull/10424.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/10424/head:pull/10424

PR: https://git.openjdk.org/jdk/pull/10424


More information about the serviceability-dev mailing list