From a8ddbd155bf65431de81b41500b4e329b2c29078 Mon Sep 17 00:00:00 2001 From: Chris Plummer Date: Thu, 22 Apr 2021 23:27:33 +0000 Subject: [PATCH] 8265683: vmTestbase/nsk/jdb tests failed with "JDWP exit error AGENT_ERROR_INTERNAL(181)" Reviewed-by: amenkov, dcubed --- .../share/native/libjdwp/threadControl.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/jdk.jdwp.agent/share/native/libjdwp/threadControl.c b/src/jdk.jdwp.agent/share/native/libjdwp/threadControl.c index 9255d6a6ea8..426f1c9c975 100644 --- a/src/jdk.jdwp.agent/share/native/libjdwp/threadControl.c +++ b/src/jdk.jdwp.agent/share/native/libjdwp/threadControl.c @@ -253,8 +253,15 @@ findThread(ThreadList *list, jthread thread) if ( list == NULL || list == &otherThreads ) { node = nonTlsSearch(getEnv(), &otherThreads, thread); } - /* A thread with no TLS should never be in the runningThreads list. */ - JDI_ASSERT(!nonTlsSearch(getEnv(), &runningThreads, thread)); + /* + * Search runningThreads list. The TLS lookup may have failed because the + * thread has terminated, but the ThreadNode may still be present. + */ + if ( node == NULL ) { + if ( list == NULL || list == &runningThreads ) { + node = nonTlsSearch(getEnv(), &runningThreads, thread); + } + } } /* If a list is supplied, only return ones in this list */