mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8286960: Test serviceability/jvmti/vthread/SuspendResume2 crashed: missing ThreadsListHandle in calling context
Reviewed-by: dholmes, pchilanomate, amenkov
This commit is contained in:
parent
3d6d7b7e73
commit
94811c0dc7
2 changed files with 10 additions and 9 deletions
|
@ -929,13 +929,13 @@ JvmtiEnv::GetAllThreads(jint* threads_count_ptr, jthread** threads_ptr) {
|
||||||
jvmtiError
|
jvmtiError
|
||||||
JvmtiEnv::SuspendThread(jthread thread) {
|
JvmtiEnv::SuspendThread(jthread thread) {
|
||||||
JavaThread* current = JavaThread::current();
|
JavaThread* current = JavaThread::current();
|
||||||
ThreadsListHandle tlh(current);
|
|
||||||
|
|
||||||
jvmtiError err;
|
jvmtiError err;
|
||||||
JavaThread* java_thread = NULL;
|
JavaThread* java_thread = NULL;
|
||||||
oop thread_oop = NULL;
|
oop thread_oop = NULL;
|
||||||
{
|
{
|
||||||
JvmtiVTMSTransitionDisabler disabler(true);
|
JvmtiVTMSTransitionDisabler disabler(true);
|
||||||
|
ThreadsListHandle tlh(current);
|
||||||
|
|
||||||
err = get_threadOop_and_JavaThread(tlh.list(), thread, &java_thread, &thread_oop);
|
err = get_threadOop_and_JavaThread(tlh.list(), thread, &java_thread, &thread_oop);
|
||||||
if (err != JVMTI_ERROR_NONE) {
|
if (err != JVMTI_ERROR_NONE) {
|
||||||
|
@ -960,13 +960,13 @@ JvmtiEnv::SuspendThread(jthread thread) {
|
||||||
jvmtiError
|
jvmtiError
|
||||||
JvmtiEnv::SuspendThreadList(jint request_count, const jthread* request_list, jvmtiError* results) {
|
JvmtiEnv::SuspendThreadList(jint request_count, const jthread* request_list, jvmtiError* results) {
|
||||||
JavaThread* current = JavaThread::current();
|
JavaThread* current = JavaThread::current();
|
||||||
ThreadsListHandle tlh(current);
|
|
||||||
HandleMark hm(current);
|
HandleMark hm(current);
|
||||||
Handle self_tobj = Handle(current, NULL);
|
Handle self_tobj = Handle(current, NULL);
|
||||||
int self_idx = -1;
|
int self_idx = -1;
|
||||||
|
|
||||||
{
|
{
|
||||||
JvmtiVTMSTransitionDisabler disabler(true);
|
JvmtiVTMSTransitionDisabler disabler(true);
|
||||||
|
ThreadsListHandle tlh(current);
|
||||||
|
|
||||||
for (int i = 0; i < request_count; i++) {
|
for (int i = 0; i < request_count; i++) {
|
||||||
JavaThread *java_thread = NULL;
|
JavaThread *java_thread = NULL;
|
||||||
|
@ -1013,19 +1013,20 @@ JvmtiEnv::SuspendAllVirtualThreads(jint except_count, const jthread* except_list
|
||||||
return JVMTI_ERROR_NONE; // Nothing to do when there are no virtual threads;
|
return JVMTI_ERROR_NONE; // Nothing to do when there are no virtual threads;
|
||||||
}
|
}
|
||||||
JavaThread* current = JavaThread::current();
|
JavaThread* current = JavaThread::current();
|
||||||
ThreadsListHandle tlh(current);
|
|
||||||
jvmtiError err = JvmtiEnvBase::check_thread_list(except_count, except_list);
|
|
||||||
if (err != JVMTI_ERROR_NONE) {
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
HandleMark hm(current);
|
HandleMark hm(current);
|
||||||
Handle self_tobj = Handle(current, NULL);
|
Handle self_tobj = Handle(current, NULL);
|
||||||
|
|
||||||
{
|
{
|
||||||
ResourceMark rm(current);
|
ResourceMark rm(current);
|
||||||
JvmtiVTMSTransitionDisabler disabler(true);
|
JvmtiVTMSTransitionDisabler disabler(true);
|
||||||
|
ThreadsListHandle tlh(current);
|
||||||
GrowableArray<jthread>* elist = new GrowableArray<jthread>(except_count);
|
GrowableArray<jthread>* elist = new GrowableArray<jthread>(except_count);
|
||||||
|
|
||||||
|
jvmtiError err = JvmtiEnvBase::check_thread_list(except_count, except_list);
|
||||||
|
if (err != JVMTI_ERROR_NONE) {
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
// Collect threads from except_list for which resumed status must be restored.
|
// Collect threads from except_list for which resumed status must be restored.
|
||||||
for (int idx = 0; idx < except_count; idx++) {
|
for (int idx = 0; idx < except_count; idx++) {
|
||||||
jthread thread = except_list[idx];
|
jthread thread = except_list[idx];
|
||||||
|
|
|
@ -1778,8 +1778,8 @@ bool JavaThread::java_suspend() {
|
||||||
assert(!is_VTMS_transition_disabler(), "no suspend allowed for VTMS transition disablers");
|
assert(!is_VTMS_transition_disabler(), "no suspend allowed for VTMS transition disablers");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
guarantee(Thread::is_JavaThread_protected_by_TLH(/* target */ this),
|
guarantee(Thread::is_JavaThread_protected(/* target */ this),
|
||||||
"missing ThreadsListHandle in calling context.");
|
"target JavaThread is not protected in calling context.");
|
||||||
return this->handshake_state()->suspend();
|
return this->handshake_state()->suspend();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue