RFR: 8365630: jdk/jfr/tool/TestPrintContextual.java fails with wrong spanId

Erik Gahlin egahlin at openjdk.org
Mon Oct 6 09:20:24 UTC 2025


On Mon, 6 Oct 2025 07:43:47 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> Could I get a review of a test fix that emits events with unique timestamps, so the contextual information is printed in chronological order?
>> 
>> Testing: 500 *  jdk/jfr/tool/TestPrintContextual.java
>> 
>> Thanks
>> Erik
>
> test/jdk/jdk/jfr/tool/TestPrintContextual.java line 288:
> 
>> 286:                 Thread.sleep(1);
>> 287:             } catch (InterruptedException e) {
>> 288:                 // ignore
> 
> Why ignore, though? This would make the thread stuck even if someone actively tries to interrupt it. A common practice in these non-critical methods is to restore the interrupt status and return.
> 
> 
> } catch (InterruptedException e) {
>     Thread.currentThread().interrupt();
>     return;
> }

The purpose is to save CPU cycles instead of spinning. I'm not sure how returning would help? The test would become unreliable, since two timestamp may be the same.

I could let the method throw an InterruptedException so the test fails, but it would result in a false positive. Perhaps, if jtreg for some reason wanted to shut down the test early, it could serve a purpose.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27626#discussion_r2405451608


More information about the hotspot-jfr-dev mailing list