RFR: 8243455: Many SA tests can fail due to trying to get the stack trace of an active method [v2]
Serguei Spitsyn
sspitsyn at openjdk.java.net
Wed Mar 10 01:07:12 UTC 2021
On Tue, 9 Mar 2021 18:13:09 GMT, Leonid Mesnik <lmesnik at openjdk.org> wrote:
>> Chris Plummer has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Use onSpinWait() instead of sleep(), and check for BLOCKED thread state.
>
> Marked as reviewed by lmesnik (Committer).
Chris,
test/lib/jdk/test/lib/apps/LingeredApp.java
It is better to rename `startSteadStateThread` to `startSteadyStateThread`, otherwise it seems to be a typo.
+ try {
+ // Sleep until the thread has started running.
+ while (!steadyStateReached) {
+ Thread.sleep(100);
+ }
+ // Do another short sleep so we can get into the synchronized block,
+ // although this probably is not necessary to guarantee that the
+ // stack trace is readable.
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ }
It is better to remove the second sleep as it is not really needed.
Another concern is that the stack trace of this thread is going to be trivial, not sure if it is useful.
But it can be okay though if it serves trivial purposes. :)
It feels like something better is needed in general.
-Serguei
-------------
PR: https://git.openjdk.java.net/jdk/pull/2700
More information about the serviceability-dev
mailing list