Add workaround for JDK-8287073 to tests#2052
Conversation
|
I have two questions that may be clarified in the comment:
Also, why don't we need the same workaround here in our production code? |
There are two commits in this PR and first one that merely adds comment shows that test fails on JDK 18 in both Azure Pipelines and GitHub Actions - quoting its build log https://github.com/jacoco/jacoco/actions/runs/22118309518/job/63932012624 First time I noticed this failure in my fork yesterday, multiple re-runs demonstrate that this test steadily fails only on JDK 18. So I'm ready to bet that restart of build on master without any changes will fail the same way. I do not know why this started to happen just recently and why only on JDK 18 - to me seems that much more versions should be affected according to https://bugs.openjdk.org/browse/JDK-8287073 which states that fix was made in 19 and backported only to LTS versions 17, 11, and 8.
This is quick attempt to do workaround based on shallow observation that several tests use Here is my wield guess: during first call initialization of some field in some component causes NPE, so field ends up with default
Most important argument for/from me to apply this only in tests is that otherwise user code that calls Such change of behavior of user code sounds similar to #1334 which clearly an example of bad thing. Making an analogy with physic - to me JaCoCo Agent is observer and we should do our best to minimize observer effect. Due to observer effect, people already undeservedly blame JaCoCo when JVM crashes with SIGSEGV caused by bug in HotSpot - see for example #1801. And while someone might argue that in this case it will be example of good thing, IMO it is not responsibility of JaCoCo Agent to deliver workarounds for bugs in JDK 😉 |
Seems to be the case - even if second invocation of |
marchof
left a comment
There was a problem hiding this comment.
Many thanks for the detailed explanation!
|
@Godin @marchof sorry folks to chime in, we've also observed this issue while running builds on older JDKs (no changes to codebases whatsoever), what is interesting is that if switching GA runners from Ubuntu 24.04 to 22.04 seems to fix the problem (however that could be temporary as well), just some data points |
|
@reta wait, did you see a stack trace specific to JaCoCo? Or did this happen in your code only? |
@marchof Sorry, should have been more clear, not jacoco related (yet), this is specific to our project (https://github.com/Opensearch-project/opensearch-java), but just all the same cause (the checks started to fails out of the blue for some older JDKs) |
|
@marchof agent registers its MBean at startup which is guarded by agent option So it can fail only if explicitly enabled: and in such case Also I just re-triggered build of #2023 and for some reason failure is gone 😅 |
|
Failures started to happen again, so I'm merging this workaround. |
No description provided.