RFR: 8262197: JDK-8242032 uses wrong contains_reference() in assertion code

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

RFR: 8262197: JDK-8242032 uses wrong contains_reference() in assertion code

Thomas Schatzl-4
Hi all,

  can I have reviews for this change that fixes use of the wrong HeapRegionRemSet::contains_reference() method, causing a thread lock the same mutex again, resulting in problems like assertion failures?

The code in question has been introduced in JDK-8242032:


    +    // Rechecking if the region is coarsened, while holding the lock.
    +    if (is_region_coarsened(from_hrm_ind)) {
    +      assert(contains_reference(from), "We just found " PTR_FORMAT " in the Coarse table", p2i(from));
    +      return;
    +    }

The problem is the call to `contains_reference`, which locks the same lock that "we know we are already locking" per the comment above. Correct is using `contains_reference_locked` added for just this purpose.

In the original change the PR already mentioned that the situation where this condition should hold could not be reproduced - now we know that it actually occurs ;)

Testing: tier1. Trying to reproduce with the original some of the failing tests without luck - however the problematic line and the fix is very obvious.

Thanks,
  Thomas

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

Commit messages:
 - Use correct contains_reference_locked

Changes: https://git.openjdk.java.net/jdk/pull/2690/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2690&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8262197
  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2690.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2690/head:pull/2690

PR: https://git.openjdk.java.net/jdk/pull/2690
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8262197: JDK-8242032 uses wrong contains_reference() in assertion code

Albert Mingkun Yang
On Tue, 23 Feb 2021 13:22:25 GMT, Thomas Schatzl <[hidden email]> wrote:

> Hi all,
>
>   can I have reviews for this change that fixes use of the wrong HeapRegionRemSet::contains_reference() method, causing a thread lock the same mutex again, resulting in problems like assertion failures?
>
> The code in question has been introduced in JDK-8242032:
>
>
>     +    // Rechecking if the region is coarsened, while holding the lock.
>     +    if (is_region_coarsened(from_hrm_ind)) {
>     +      assert(contains_reference(from), "We just found " PTR_FORMAT " in the Coarse table", p2i(from));
>     +      return;
>     +    }
>
> The problem is the call to `contains_reference`, which locks the same lock that "we know we are already locking" per the comment above. Correct is using `contains_reference_locked` added for just this purpose.
>
> In the original change the PR already mentioned that the situation where this condition should hold could not be reproduced - now we know that it actually occurs ;)
>
> Testing: tier1. Trying to reproduce with the original some of the failing tests without luck - however the problematic line and the fix is very obvious.
>
> Thanks,
>   Thomas

Marked as reviewed by ayang (Author).

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

PR: https://git.openjdk.java.net/jdk/pull/2690
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8262197: JDK-8242032 uses wrong contains_reference() in assertion code

Kim Barrett-2
In reply to this post by Thomas Schatzl-4
On Tue, 23 Feb 2021 13:22:25 GMT, Thomas Schatzl <[hidden email]> wrote:

> Hi all,
>
>   can I have reviews for this change that fixes use of the wrong HeapRegionRemSet::contains_reference() method, causing a thread lock the same mutex again, resulting in problems like assertion failures?
>
> The code in question has been introduced in JDK-8242032:
>
>
>     +    // Rechecking if the region is coarsened, while holding the lock.
>     +    if (is_region_coarsened(from_hrm_ind)) {
>     +      assert(contains_reference(from), "We just found " PTR_FORMAT " in the Coarse table", p2i(from));
>     +      return;
>     +    }
>
> The problem is the call to `contains_reference`, which locks the same lock that "we know we are already locking" per the comment above. Correct is using `contains_reference_locked` added for just this purpose.
>
> In the original change the PR already mentioned that the situation where this condition should hold could not be reproduced - now we know that it actually occurs ;)
>
> Testing: tier1. Trying to reproduce with the original some of the failing tests without luck - however the problematic line and the fix is very obvious.
>
> Thanks,
>   Thomas

Marked as reviewed by kbarrett (Reviewer).

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

PR: https://git.openjdk.java.net/jdk/pull/2690
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8262197: JDK-8242032 uses wrong contains_reference() in assertion code

Kim Barrett-2
On Tue, 23 Feb 2021 15:49:17 GMT, Kim Barrett <[hidden email]> wrote:

>> Hi all,
>>
>>   can I have reviews for this change that fixes use of the wrong HeapRegionRemSet::contains_reference() method, causing a thread lock the same mutex again, resulting in problems like assertion failures?
>>
>> The code in question has been introduced in JDK-8242032:
>>
>>
>>     +    // Rechecking if the region is coarsened, while holding the lock.
>>     +    if (is_region_coarsened(from_hrm_ind)) {
>>     +      assert(contains_reference(from), "We just found " PTR_FORMAT " in the Coarse table", p2i(from));
>>     +      return;
>>     +    }
>>
>> The problem is the call to `contains_reference`, which locks the same lock that "we know we are already locking" per the comment above. Correct is using `contains_reference_locked` added for just this purpose.
>>
>> In the original change the PR already mentioned that the situation where this condition should hold could not be reproduced - now we know that it actually occurs ;)
>>
>> Testing: tier1. Trying to reproduce with the original some of the failing tests without luck - however the problematic line and the fix is very obvious.
>>
>> Thanks,
>>   Thomas
>
> Marked as reviewed by kbarrett (Reviewer).

As this is pretty simple, and seems likely to introduce a lot of testing noise, I'd be okay with pushing without waiting for 24h.

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

PR: https://git.openjdk.java.net/jdk/pull/2690
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8262197: JDK-8242032 uses wrong contains_reference() in assertion code

Thomas Schatzl-4
In reply to this post by Albert Mingkun Yang
On Tue, 23 Feb 2021 15:25:56 GMT, Albert Mingkun Yang <[hidden email]> wrote:

>> Hi all,
>>
>>   can I have reviews for this change that fixes use of the wrong HeapRegionRemSet::contains_reference() method, causing a thread lock the same mutex again, resulting in problems like assertion failures?
>>
>> The code in question has been introduced in JDK-8242032:
>>
>>
>>     +    // Rechecking if the region is coarsened, while holding the lock.
>>     +    if (is_region_coarsened(from_hrm_ind)) {
>>     +      assert(contains_reference(from), "We just found " PTR_FORMAT " in the Coarse table", p2i(from));
>>     +      return;
>>     +    }
>>
>> The problem is the call to `contains_reference`, which locks the same lock that "we know we are already locking" per the comment above. Correct is using `contains_reference_locked` added for just this purpose.
>>
>> In the original change the PR already mentioned that the situation where this condition should hold could not be reproduced - now we know that it actually occurs ;)
>>
>> Testing: tier1. Trying to reproduce with the original some of the failing tests without luck - however the problematic line and the fix is very obvious.
>>
>> Thanks,
>>   Thomas
>
> Marked as reviewed by ayang (Author).

Thanks @albertnetymk @kimbarrett for the reviews.

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

PR: https://git.openjdk.java.net/jdk/pull/2690
Reply | Threaded
Open this post in threaded view
|

Integrated: 8262197: JDK-8242032 uses wrong contains_reference() in assertion code

Thomas Schatzl-4
In reply to this post by Thomas Schatzl-4
On Tue, 23 Feb 2021 13:22:25 GMT, Thomas Schatzl <[hidden email]> wrote:

> Hi all,
>
>   can I have reviews for this change that fixes use of the wrong HeapRegionRemSet::contains_reference() method, causing a thread lock the same mutex again, resulting in problems like assertion failures?
>
> The code in question has been introduced in JDK-8242032:
>
>
>     +    // Rechecking if the region is coarsened, while holding the lock.
>     +    if (is_region_coarsened(from_hrm_ind)) {
>     +      assert(contains_reference(from), "We just found " PTR_FORMAT " in the Coarse table", p2i(from));
>     +      return;
>     +    }
>
> The problem is the call to `contains_reference`, which locks the same lock that "we know we are already locking" per the comment above. Correct is using `contains_reference_locked` added for just this purpose.
>
> In the original change the PR already mentioned that the situation where this condition should hold could not be reproduced - now we know that it actually occurs ;)
>
> Testing: tier1. Trying to reproduce with the original some of the failing tests without luck - however the problematic line and the fix is very obvious.
>
> Thanks,
>   Thomas

This pull request has now been integrated.

Changeset: 67762de6
Author:    Thomas Schatzl <[hidden email]>
URL:       https://git.openjdk.java.net/jdk/commit/67762de6
Stats:     1 line in 1 file changed: 0 ins; 0 del; 1 mod

8262197: JDK-8242032 uses wrong contains_reference() in assertion code

Reviewed-by: ayang, kbarrett

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

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