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

Chris Plummer cjplummer at openjdk.org
Thu May 29 20:44:51 UTC 2025


On Thu, 29 May 2025 18:10:55 GMT, Leonid Mesnik <lmesnik 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.
>
> 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.

Since there is only one writer thread, volatile should be sufficient. The only requirement is to make writes visible to the reader thread. volatile accomplishes that.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25236#discussion_r2114719187


More information about the serviceability-dev mailing list