RFR: 8357184: Test vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent008/TestDescription.java fails with unreported exception

Leonid Mesnik lmesnik at openjdk.org
Thu May 29 18:13:53 UTC 2025


On Wed, 14 May 2025 18:54:49 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:

> Based on the log output, the test failure seems to be the result of two threads trying to set and access variables that are not volatile, so I've made them volatile. Since I can't reproduce the failure, I can't confirm that it is now fixed, but the lack of volatile is clearly a bug so should be done anyway. Tested by running the test locally to make sure nothing breaks.

Changes requested by lmesnik (Reviewer).

test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent008.java line 83:

> 81:     private ReferenceType rType, rTypeEx;
> 82:     private String cmd;
> 83:     private volatile int counter1 = 0, counter2 = 0;

The volatile is not enough for increment. It might be not affect test if you check 0/non-0 only but still not a good way.
Better to use AtomicInteger or set/read variable only.

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

PR Review: https://git.openjdk.org/jdk/pull/25236#pullrequestreview-2879186245
PR Review Comment: https://git.openjdk.org/jdk/pull/25236#discussion_r2114495149


More information about the serviceability-dev mailing list