RFR: 8267579: Thread::cooked_allocated_bytes() hits assert(left >= right) failed: avoid underflow

David Holmes dholmes at openjdk.java.net
Mon Jun 7 07:47:00 UTC 2021


On Mon, 7 Jun 2021 07:01:12 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:

>> This is a workaround to avoid hitting the assert that was recently added to pointer_delta(). 
>> 
>> The implementation of cooked_allocated_bytes() is perhaps questionable, in that it reads tlab pointers optimistically. However, the functionality has been in place for a long time, and the impact of changing its behavior more substantially is unknown at this time, hence this defensive workaround to reduce noise and problems seen in general testing.
>> 
>> Testing: tier1, tier2, tier6, tier8
>> 
>> Thanks
>> Markus
>
> This is a race-condition and will potentially fail just the same way the bug in #4224 did. There needs to be at least Atomic::loads of the the variables, or the compiler could convert the loads into multiple loads.

@stefank has explained in the bug report why the assertion is not the issue - thanks. So I have to question the validity of just side-stepping the assertion without trying to fix the broken code. What are the implications of finding these broken invariants in the product code? Do we just report/print an incorrect value?

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

PR: https://git.openjdk.java.net/jdk/pull/4363


More information about the hotspot-jfr-dev mailing list