RFR: 8357184: Test vmTestbase/nsk/jdi/ExceptionEvent/_itself_/exevent008/TestDescription.java fails with unreported exception
Chris Plummer
cjplummer at openjdk.org
Fri May 30 01:48:01 UTC 2025
On Fri, 30 May 2025 01:12:34 GMT, Chris Plummer <cjplummer at openjdk.org> wrote:
>> I think the evaluation is not correct (lack of synchronization is an issue too).
>> main thread also writes the value and I think this is the problem here.
>> Look at line 148 - it resets `counter1` instead of `counter2` and this happens after the test sends `COMMAND_TEST1`. So if listener thread already handled caught exception, we get the failure.
>
> Yes, I noticed that, and I think the resetting is a bug. Probably left over from when the test was originally written. I think both of those resets can be removed. It only makes sense to reset the counters if first you check them and produce an error if one of them was unexpectedly set. For example, after the the first part of the test counter1 should be 1 and counter2 should be zero. After making that check, both counters should be reset. After the 2nd part it should verify that counter1 is 0 and counter2 is 1. However, this test does not have the needed synchronization to make those types of checks. So instead it waits for the debuggee to exit and then checks that both counters are not 0. Also, it could (should) just check for 1 intead. There should never be more than one of each exception event generated.
Actually the 2nd exception is received twice, but this is also a bug. When using the vthread wrapper, an exception handler is added which catches the exception and then rethrows it, so we get two ExceptionEvents for this event. If the test was a bit more thorough, it would be verifying that the exception is indeed uncaught, and fail if it isnot, but then we'd have to start excluding this test with vthread testing (and no real way of fixing it).
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25236#discussion_r2115000668
More information about the serviceability-dev
mailing list