Re: RFR: 8330303: Crash: assert(_target_jt == nullptr || _target_jt->vthread() == target_h()) failed [v3]

2024-04-24 Thread Serguei Spitsyn
On Wed, 24 Apr 2024 05:44:42 GMT, Chris Plummer  wrote:

>> Serguei Spitsyn has updated the pull request with a new target base due to a 
>> merge or a rebase. The incremental webrev excludes the unrelated changes 
>> brought in by the merge/rebase. The pull request contains four additional 
>> commits since the last revision:
>> 
>>  - “Merge”
>>  - review: updated same clarifying comment in several spots
>>  - add comments explaining that the vthread() can return outdated oop
>>  - 8330303: Crash: assert(_target_jt == nullptr || _target_jt->vthread() == 
>> target_h()) failed
>
> src/hotspot/share/prims/jvmtiEnvBase.cpp line 2079:
> 
>> 2077: void
>> 2078: GetSingleStackTraceClosure::do_vthread(Handle target_h) {
>> 2079:   // Use jvmti_vthread() instead of vthread() as target could have 
>> temporary changed
> 
> Suggestion:
> 
>   // Use jvmti_vthread() instead of vthread() as target could have 
> temporarily changed

Good catch, fixed now.

> src/hotspot/share/prims/jvmtiEnvBase.hpp line 509:
> 
>> 507:   void do_vthread(Handle target_h) {
>> 508: assert(_target_jt != nullptr, "sanity check");
>> 509: // Use jvmti_vthread() instead of vthread() as target could have 
>> temporary changed
> 
> Suggestion:
> 
> // Use jvmti_vthread() instead of vthread() as target could have 
> temporarily changed

Good catch, thanks. Fixed now.

> src/hotspot/share/prims/jvmtiEnvBase.hpp line 531:
> 
>> 529:   void do_vthread(Handle target_h) {
>> 530: assert(_target_jt != nullptr, "sanity check");
>> 531: // Use jvmti_vthread() instead of vthread() as target could have 
>> temporary changed
> 
> Suggestion:
> 
> // Use jvmti_vthread() instead of vthread() as target could have 
> temporarily changed

Good catch, thanks. Fixed now.

-

PR Review Comment: https://git.openjdk.org/jdk/pull/18806#discussion_r1577621820
PR Review Comment: https://git.openjdk.org/jdk/pull/18806#discussion_r1577623055
PR Review Comment: https://git.openjdk.org/jdk/pull/18806#discussion_r1577622556


Re: RFR: 8330303: Crash: assert(_target_jt == nullptr || _target_jt->vthread() == target_h()) failed [v4]

2024-04-24 Thread Serguei Spitsyn
> This is a simple fix of three similar asserts.
> The `_target_jt->jvmti_vthread()` has to be used instead of 
> `_target_jt->vthread()`. 
> The `_target_jt->vthread()` can be outdated in some specific contexts as 
> shown in the `hs_err` stack trace.
> 
> I've seen similar issue and already fixed it in this fragment of code:
> 
> class GetCurrentLocationClosure : public JvmtiUnitedHandshakeClosure {
>   . . .
>   void do_vthread(Handle target_h) {
> assert(_target_jt == nullptr || !_target_jt->is_exiting(), "sanity 
> check");
> // use jvmti_vthread() as vthread() can be outdated
> assert(_target_jt == nullptr || _target_jt->jvmti_vthread() == 
> target_h(), "sanity check");
> . . .
> 
> The issue above was fixed by replacing `_target_jt->vthread()` with 
> `_target_jt->jvmti_vthread()`.
> 
> There are three places which need to be fixed the same way:
>  - `GetSingleStackTraceClosure::do_vthread(Handle target_h)`
>  - `SetForceEarlyReturn::do_vthread(Handle target_h)`
>  - `UpdateForPopTopFrameClosure::do_vthread(Handle target_h)`
> 
> Testing:
>  - Run mach5 tiers 1-6

Serguei Spitsyn has updated the pull request incrementally with one additional 
commit since the last revision:

  review: fixed typo in same comment in several spots

-

Changes:
  - all: https://git.openjdk.org/jdk/pull/18806/files
  - new: https://git.openjdk.org/jdk/pull/18806/files/c5ad80d0..643c3046

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk=18806=03
 - incr: https://webrevs.openjdk.org/?repo=jdk=18806=02-03

  Stats: 4 lines in 3 files changed: 0 ins; 0 del; 4 mod
  Patch: https://git.openjdk.org/jdk/pull/18806.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/18806/head:pull/18806

PR: https://git.openjdk.org/jdk/pull/18806


Re: RFR: 8330303: Crash: assert(_target_jt == nullptr || _target_jt->vthread() == target_h()) failed [v3]

2024-04-23 Thread Chris Plummer
On Wed, 24 Apr 2024 02:49:56 GMT, Serguei Spitsyn  wrote:

>> This is a simple fix of three similar asserts.
>> The `_target_jt->jvmti_vthread()` has to be used instead of 
>> `_target_jt->vthread()`. 
>> The `_target_jt->vthread()` can be outdated in some specific contexts as 
>> shown in the `hs_err` stack trace.
>> 
>> I've seen similar issue and already fixed it in this fragment of code:
>> 
>> class GetCurrentLocationClosure : public JvmtiUnitedHandshakeClosure {
>>   . . .
>>   void do_vthread(Handle target_h) {
>> assert(_target_jt == nullptr || !_target_jt->is_exiting(), "sanity 
>> check");
>> // use jvmti_vthread() as vthread() can be outdated
>> assert(_target_jt == nullptr || _target_jt->jvmti_vthread() == 
>> target_h(), "sanity check");
>> . . .
>> 
>> The issue above was fixed by replacing `_target_jt->vthread()` with 
>> `_target_jt->jvmti_vthread()`.
>> 
>> There are three places which need to be fixed the same way:
>>  - `GetSingleStackTraceClosure::do_vthread(Handle target_h)`
>>  - `SetForceEarlyReturn::do_vthread(Handle target_h)`
>>  - `UpdateForPopTopFrameClosure::do_vthread(Handle target_h)`
>> 
>> Testing:
>>  - Run mach5 tiers 1-6
>
> Serguei Spitsyn has updated the pull request with a new target base due to a 
> merge or a rebase. The incremental webrev excludes the unrelated changes 
> brought in by the merge/rebase. The pull request contains four additional 
> commits since the last revision:
> 
>  - “Merge”
>  - review: updated same clarifying comment in several spots
>  - add comments explaining that the vthread() can return outdated oop
>  - 8330303: Crash: assert(_target_jt == nullptr || _target_jt->vthread() == 
> target_h()) failed

src/hotspot/share/prims/jvmtiEnvBase.cpp line 2079:

> 2077: void
> 2078: GetSingleStackTraceClosure::do_vthread(Handle target_h) {
> 2079:   // Use jvmti_vthread() instead of vthread() as target could have 
> temporary changed

Suggestion:

  // Use jvmti_vthread() instead of vthread() as target could have temporarily 
changed

src/hotspot/share/prims/jvmtiEnvBase.hpp line 509:

> 507:   void do_vthread(Handle target_h) {
> 508: assert(_target_jt != nullptr, "sanity check");
> 509: // Use jvmti_vthread() instead of vthread() as target could have 
> temporary changed

Suggestion:

// Use jvmti_vthread() instead of vthread() as target could have 
temporarily changed

src/hotspot/share/prims/jvmtiEnvBase.hpp line 531:

> 529:   void do_vthread(Handle target_h) {
> 530: assert(_target_jt != nullptr, "sanity check");
> 531: // Use jvmti_vthread() instead of vthread() as target could have 
> temporary changed

Suggestion:

// Use jvmti_vthread() instead of vthread() as target could have 
temporarily changed

-

PR Review Comment: https://git.openjdk.org/jdk/pull/18806#discussion_r1577299642
PR Review Comment: https://git.openjdk.org/jdk/pull/18806#discussion_r1577299918
PR Review Comment: https://git.openjdk.org/jdk/pull/18806#discussion_r1577300305


Re: RFR: 8330303: Crash: assert(_target_jt == nullptr || _target_jt->vthread() == target_h()) failed [v3]

2024-04-23 Thread Serguei Spitsyn
> This is a simple fix of three similar asserts.
> The `_target_jt->jvmti_vthread()` has to be used instead of 
> `_target_jt->vthread()`. 
> The `_target_jt->vthread()` can be outdated in some specific contexts as 
> shown in the `hs_err` stack trace.
> 
> I've seen similar issue and already fixed it in this fragment of code:
> 
> class GetCurrentLocationClosure : public JvmtiUnitedHandshakeClosure {
>   . . .
>   void do_vthread(Handle target_h) {
> assert(_target_jt == nullptr || !_target_jt->is_exiting(), "sanity 
> check");
> // use jvmti_vthread() as vthread() can be outdated
> assert(_target_jt == nullptr || _target_jt->jvmti_vthread() == 
> target_h(), "sanity check");
> . . .
> 
> The issue above was fixed by replacing `_target_jt->vthread()` with 
> `_target_jt->jvmti_vthread()`.
> 
> There are three places which need to be fixed the same way:
>  - `GetSingleStackTraceClosure::do_vthread(Handle target_h)`
>  - `SetForceEarlyReturn::do_vthread(Handle target_h)`
>  - `UpdateForPopTopFrameClosure::do_vthread(Handle target_h)`
> 
> Testing:
>  - Run mach5 tiers 1-6

Serguei Spitsyn has updated the pull request with a new target base due to a 
merge or a rebase. The incremental webrev excludes the unrelated changes 
brought in by the merge/rebase. The pull request contains four additional 
commits since the last revision:

 - “Merge”
 - review: updated same clarifying comment in several spots
 - add comments explaining that the vthread() can return outdated oop
 - 8330303: Crash: assert(_target_jt == nullptr || _target_jt->vthread() == 
target_h()) failed

-

Changes:
  - all: https://git.openjdk.org/jdk/pull/18806/files
  - new: https://git.openjdk.org/jdk/pull/18806/files/6ac3b54f..c5ad80d0

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk=18806=02
 - incr: https://webrevs.openjdk.org/?repo=jdk=18806=01-02

  Stats: 52905 lines in 671 files changed: 26069 ins; 23980 del; 2856 mod
  Patch: https://git.openjdk.org/jdk/pull/18806.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/18806/head:pull/18806

PR: https://git.openjdk.org/jdk/pull/18806


Re: RFR: 8330303: Crash: assert(_target_jt == nullptr || _target_jt->vthread() == target_h()) failed [v2]

2024-04-23 Thread Serguei Spitsyn
> This is a simple fix of three similar asserts.
> The `_target_jt->jvmti_vthread()` has to be used instead of 
> `_target_jt->vthread()`. 
> The `_target_jt->vthread()` can be outdated in some specific contexts as 
> shown in the `hs_err` stack trace.
> 
> I've seen similar issue and already fixed it in this fragment of code:
> 
> class GetCurrentLocationClosure : public JvmtiUnitedHandshakeClosure {
>   . . .
>   void do_vthread(Handle target_h) {
> assert(_target_jt == nullptr || !_target_jt->is_exiting(), "sanity 
> check");
> // use jvmti_vthread() as vthread() can be outdated
> assert(_target_jt == nullptr || _target_jt->jvmti_vthread() == 
> target_h(), "sanity check");
> . . .
> 
> The issue above was fixed by replacing `_target_jt->vthread()` with 
> `_target_jt->jvmti_vthread()`.
> 
> There are three places which need to be fixed the same way:
>  - `GetSingleStackTraceClosure::do_vthread(Handle target_h)`
>  - `SetForceEarlyReturn::do_vthread(Handle target_h)`
>  - `UpdateForPopTopFrameClosure::do_vthread(Handle target_h)`
> 
> Testing:
>  - Run mach5 tiers 1-6

Serguei Spitsyn has updated the pull request incrementally with one additional 
commit since the last revision:

  review: updated same clarifying comment in several spots

-

Changes:
  - all: https://git.openjdk.org/jdk/pull/18806/files
  - new: https://git.openjdk.org/jdk/pull/18806/files/55a8ed10..6ac3b54f

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk=18806=01
 - incr: https://webrevs.openjdk.org/?repo=jdk=18806=00-01

  Stats: 8 lines in 3 files changed: 4 ins; 0 del; 4 mod
  Patch: https://git.openjdk.org/jdk/pull/18806.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/18806/head:pull/18806

PR: https://git.openjdk.org/jdk/pull/18806


Re: RFR: 8330303: Crash: assert(_target_jt == nullptr || _target_jt->vthread() == target_h()) failed

2024-04-23 Thread Serguei Spitsyn
On Wed, 17 Apr 2024 00:29:52 GMT, Serguei Spitsyn  wrote:

> This is a simple fix of three similar asserts.
> The `_target_jt->jvmti_vthread()` has to be used instead of 
> `_target_jt->vthread()`. 
> The `_target_jt->vthread()` can be outdated in some specific contexts as 
> shown in the `hs_err` stack trace.
> 
> I've seen similar issue and already fixed it in this fragment of code:
> 
> class GetCurrentLocationClosure : public JvmtiUnitedHandshakeClosure {
>   . . .
>   void do_vthread(Handle target_h) {
> assert(_target_jt == nullptr || !_target_jt->is_exiting(), "sanity 
> check");
> // use jvmti_vthread() as vthread() can be outdated
> assert(_target_jt == nullptr || _target_jt->jvmti_vthread() == 
> target_h(), "sanity check");
> . . .
> 
> The issue above was fixed by replacing `_target_jt->vthread()` with 
> `_target_jt->jvmti_vthread()`.
> 
> There are three places which need to be fixed the same way:
>  - `GetSingleStackTraceClosure::do_vthread(Handle target_h)`
>  - `SetForceEarlyReturn::do_vthread(Handle target_h)`
>  - `UpdateForPopTopFrameClosure::do_vthread(Handle target_h)`
> 
> Testing:
>  - Run mach5 tiers 1-6

Thank you for review, Leonid!

-

PR Comment: https://git.openjdk.org/jdk/pull/18806#issuecomment-2073695339


Re: RFR: 8330303: Crash: assert(_target_jt == nullptr || _target_jt->vthread() == target_h()) failed

2024-04-23 Thread Leonid Mesnik
On Wed, 17 Apr 2024 00:29:52 GMT, Serguei Spitsyn  wrote:

> This is a simple fix of three similar asserts.
> The `_target_jt->jvmti_vthread()` has to be used instead of 
> `_target_jt->vthread()`. 
> The `_target_jt->vthread()` can be outdated in some specific contexts as 
> shown in the `hs_err` stack trace.
> 
> I've seen similar issue and already fixed it in this fragment of code:
> 
> class GetCurrentLocationClosure : public JvmtiUnitedHandshakeClosure {
>   . . .
>   void do_vthread(Handle target_h) {
> assert(_target_jt == nullptr || !_target_jt->is_exiting(), "sanity 
> check");
> // use jvmti_vthread() as vthread() can be outdated
> assert(_target_jt == nullptr || _target_jt->jvmti_vthread() == 
> target_h(), "sanity check");
> . . .
> 
> The issue above was fixed by replacing `_target_jt->vthread()` with 
> `_target_jt->jvmti_vthread()`.
> 
> There are three places which need to be fixed the same way:
>  - `GetSingleStackTraceClosure::do_vthread(Handle target_h)`
>  - `SetForceEarlyReturn::do_vthread(Handle target_h)`
>  - `UpdateForPopTopFrameClosure::do_vthread(Handle target_h)`
> 
> Testing:
>  - Run mach5 tiers 1-6

Marked as reviewed by lmesnik (Reviewer).

-

PR Review: https://git.openjdk.org/jdk/pull/18806#pullrequestreview-2018506993


Re: RFR: 8330303: Crash: assert(_target_jt == nullptr || _target_jt->vthread() == target_h()) failed

2024-04-23 Thread Serguei Spitsyn
On Tue, 23 Apr 2024 19:05:38 GMT, Patricio Chilano Mateo 
 wrote:

>> This is a simple fix of three similar asserts.
>> The `_target_jt->jvmti_vthread()` has to be used instead of 
>> `_target_jt->vthread()`. 
>> The `_target_jt->vthread()` can be outdated in some specific contexts as 
>> shown in the `hs_err` stack trace.
>> 
>> I've seen similar issue and already fixed it in this fragment of code:
>> 
>> class GetCurrentLocationClosure : public JvmtiUnitedHandshakeClosure {
>>   . . .
>>   void do_vthread(Handle target_h) {
>> assert(_target_jt == nullptr || !_target_jt->is_exiting(), "sanity 
>> check");
>> // use jvmti_vthread() as vthread() can be outdated
>> assert(_target_jt == nullptr || _target_jt->jvmti_vthread() == 
>> target_h(), "sanity check");
>> . . .
>> 
>> The issue above was fixed by replacing `_target_jt->vthread()` with 
>> `_target_jt->jvmti_vthread()`.
>> 
>> There are three places which need to be fixed the same way:
>>  - `GetSingleStackTraceClosure::do_vthread(Handle target_h)`
>>  - `SetForceEarlyReturn::do_vthread(Handle target_h)`
>>  - `UpdateForPopTopFrameClosure::do_vthread(Handle target_h)`
>> 
>> Testing:
>>  - Run mach5 tiers 1-6
>
> src/hotspot/share/prims/jvmtiEnvBase.cpp line 2079:
> 
>> 2077: void
>> 2078: GetSingleStackTraceClosure::do_vthread(Handle target_h) {
>> 2079:   // use jvmti_vthread() as vthread() can be outdated
> 
> The only reason I can see of why just using vthread() doesn't work is because 
> of the case where we are in a temporary switch to carrier thread. So maybe 
> change comment to be: "use jvmti_vthread() instead of vthread() as target 
> could have temporary changed identity to carrier thread (see 
> VirtualThread.switchToCarrierThread)". Same in the other places.

Thank you for the suggestion. Will fix.

-

PR Review Comment: https://git.openjdk.org/jdk/pull/18806#discussion_r1576959637


Re: RFR: 8330303: Crash: assert(_target_jt == nullptr || _target_jt->vthread() == target_h()) failed

2024-04-23 Thread Serguei Spitsyn
On Wed, 17 Apr 2024 00:29:52 GMT, Serguei Spitsyn  wrote:

> This is a simple fix of three similar asserts.
> The `_target_jt->jvmti_vthread()` has to be used instead of 
> `_target_jt->vthread()`. 
> The `_target_jt->vthread()` can be outdated in some specific contexts as 
> shown in the `hs_err` stack trace.
> 
> I've seen similar issue and already fixed it in this fragment of code:
> 
> class GetCurrentLocationClosure : public JvmtiUnitedHandshakeClosure {
>   . . .
>   void do_vthread(Handle target_h) {
> assert(_target_jt == nullptr || !_target_jt->is_exiting(), "sanity 
> check");
> // use jvmti_vthread() as vthread() can be outdated
> assert(_target_jt == nullptr || _target_jt->jvmti_vthread() == 
> target_h(), "sanity check");
> . . .
> 
> The issue above was fixed by replacing `_target_jt->vthread()` with 
> `_target_jt->jvmti_vthread()`.
> 
> There are three places which need to be fixed the same way:
>  - `GetSingleStackTraceClosure::do_vthread(Handle target_h)`
>  - `SetForceEarlyReturn::do_vthread(Handle target_h)`
>  - `UpdateForPopTopFrameClosure::do_vthread(Handle target_h)`
> 
> Testing:
>  - Run mach5 tiers 1-6

Thank you for review, Patricio and Chris!

-

PR Comment: https://git.openjdk.org/jdk/pull/18806#issuecomment-2073550087


Re: RFR: 8330303: Crash: assert(_target_jt == nullptr || _target_jt->vthread() == target_h()) failed

2024-04-23 Thread Chris Plummer
On Wed, 17 Apr 2024 00:29:52 GMT, Serguei Spitsyn  wrote:

> This is a simple fix of three similar asserts.
> The `_target_jt->jvmti_vthread()` has to be used instead of 
> `_target_jt->vthread()`. 
> The `_target_jt->vthread()` can be outdated in some specific contexts as 
> shown in the `hs_err` stack trace.
> 
> I've seen similar issue and already fixed it in this fragment of code:
> 
> class GetCurrentLocationClosure : public JvmtiUnitedHandshakeClosure {
>   . . .
>   void do_vthread(Handle target_h) {
> assert(_target_jt == nullptr || !_target_jt->is_exiting(), "sanity 
> check");
> // use jvmti_vthread() as vthread() can be outdated
> assert(_target_jt == nullptr || _target_jt->jvmti_vthread() == 
> target_h(), "sanity check");
> . . .
> 
> The issue above was fixed by replacing `_target_jt->vthread()` with 
> `_target_jt->jvmti_vthread()`.
> 
> There are three places which need to be fixed the same way:
>  - `GetSingleStackTraceClosure::do_vthread(Handle target_h)`
>  - `SetForceEarlyReturn::do_vthread(Handle target_h)`
>  - `UpdateForPopTopFrameClosure::do_vthread(Handle target_h)`
> 
> Testing:
>  - Run mach5 tiers 1-6

Looks good.

-

Marked as reviewed by cjplummer (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/18806#pullrequestreview-2018277846


Re: RFR: 8330303: Crash: assert(_target_jt == nullptr || _target_jt->vthread() == target_h()) failed

2024-04-23 Thread Patricio Chilano Mateo
On Wed, 17 Apr 2024 00:29:52 GMT, Serguei Spitsyn  wrote:

> This is a simple fix of three similar asserts.
> The `_target_jt->jvmti_vthread()` has to be used instead of 
> `_target_jt->vthread()`. 
> The `_target_jt->vthread()` can be outdated in some specific contexts as 
> shown in the `hs_err` stack trace.
> 
> I've seen similar issue and already fixed it in this fragment of code:
> 
> class GetCurrentLocationClosure : public JvmtiUnitedHandshakeClosure {
>   . . .
>   void do_vthread(Handle target_h) {
> assert(_target_jt == nullptr || !_target_jt->is_exiting(), "sanity 
> check");
> // use jvmti_vthread() as vthread() can be outdated
> assert(_target_jt == nullptr || _target_jt->jvmti_vthread() == 
> target_h(), "sanity check");
> . . .
> 
> The issue above was fixed by replacing `_target_jt->vthread()` with 
> `_target_jt->jvmti_vthread()`.
> 
> There are three places which need to be fixed the same way:
>  - `GetSingleStackTraceClosure::do_vthread(Handle target_h)`
>  - `SetForceEarlyReturn::do_vthread(Handle target_h)`
>  - `UpdateForPopTopFrameClosure::do_vthread(Handle target_h)`
> 
> Testing:
>  - Run mach5 tiers 1-6

Looks good. Just small suggestion.

Thanks,
Patricio

src/hotspot/share/prims/jvmtiEnvBase.cpp line 2079:

> 2077: void
> 2078: GetSingleStackTraceClosure::do_vthread(Handle target_h) {
> 2079:   // use jvmti_vthread() as vthread() can be outdated

The only reason I can see of why just using vthread() doesn't work is because 
of the case where we are in a temporary switch to carrier thread. So maybe 
change comment to be: "use jvmti_vthread() instead of vthread() as target could 
have temporary changed identity to carrier thread (see 
VirtualThread.switchToCarrierThread)". Same in the other places.

-

Marked as reviewed by pchilanomate (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/18806#pullrequestreview-2018092388
PR Review Comment: https://git.openjdk.org/jdk/pull/18806#discussion_r1576768011


Re: RFR: 8330303: Crash: assert(_target_jt == nullptr || _target_jt->vthread() == target_h()) failed

2024-04-23 Thread Serguei Spitsyn
On Wed, 17 Apr 2024 00:29:52 GMT, Serguei Spitsyn  wrote:

> This is a simple fix of three similar asserts.
> The `_target_jt->jvmti_vthread()` has to be used instead of 
> `_target_jt->vthread()`. 
> The `_target_jt->vthread()` can be outdated in some specific contexts as 
> shown in the `hs_err` stack trace.
> 
> I've seen similar issue and already fixed it in this fragment of code:
> 
> class GetCurrentLocationClosure : public JvmtiUnitedHandshakeClosure {
>   . . .
>   void do_vthread(Handle target_h) {
> assert(_target_jt == nullptr || !_target_jt->is_exiting(), "sanity 
> check");
> // use jvmti_vthread() as vthread() can be outdated
> assert(_target_jt == nullptr || _target_jt->jvmti_vthread() == 
> target_h(), "sanity check");
> . . .
> 
> The issue above was fixed by replacing `_target_jt->vthread()` with 
> `_target_jt->jvmti_vthread()`.
> 
> There are three places which need to be fixed the same way:
>  - `GetSingleStackTraceClosure::do_vthread(Handle target_h)`
>  - `SetForceEarlyReturn::do_vthread(Handle target_h)`
>  - `UpdateForPopTopFrameClosure::do_vthread(Handle target_h)`
> 
> Testing:
>  - Run mach5 tiers 1-6

Ping!! Still need this reviewed.

-

PR Comment: https://git.openjdk.org/jdk/pull/18806#issuecomment-2073075364


RFR: 8330303: Crash: assert(_target_jt == nullptr || _target_jt->vthread() == target_h()) failed

2024-04-16 Thread Serguei Spitsyn
This is a simple fix of three similar asserts.
The `_target_jt->jvmti_vthread()` has to be used instead of 
`_target_jt->vthread()`. 
The `_target_jt->vthread()` can be outdated in some specific contexts as shown 
in the `hs_err` stack trace.

I've seen similar issue and already fixed it in this fragment of code:

class GetCurrentLocationClosure : public JvmtiUnitedHandshakeClosure {
  . . .
  void do_vthread(Handle target_h) {
assert(_target_jt == nullptr || !_target_jt->is_exiting(), "sanity check");
// use jvmti_vthread() as vthread() can be outdated
assert(_target_jt == nullptr || _target_jt->jvmti_vthread() == target_h(), 
"sanity check");
. . .

The issue above was fixed by replacing `_target_jt->vthread()` with 
`_target_jt->jvmti_vthread()`.

There are three places which need to be fixed the same way:
 - `GetSingleStackTraceClosure::do_vthread(Handle target_h)`
 - `SetForceEarlyReturn::do_vthread(Handle target_h)`
 - `UpdateForPopTopFrameClosure::do_vthread(Handle target_h)`

Testing:
 - Run mach5 tiers 1-6

-

Commit messages:
 - add comments explaining that the vthread() can return outdated oop
 - 8330303: Crash: assert(_target_jt == nullptr || _target_jt->vthread() == 
target_h()) failed

Changes: https://git.openjdk.org/jdk/pull/18806/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk=18806=00
  Issue: https://bugs.openjdk.org/browse/JDK-8330303
  Stats: 6 lines in 2 files changed: 3 ins; 0 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/18806.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/18806/head:pull/18806

PR: https://git.openjdk.org/jdk/pull/18806