On Sat, 13 Feb 2021 21:53:51 GMT, Daniel D. Daugherty <[email protected]> 
wrote:

>> A minor fix to add a new function:
>> 
>>     bool Thread::is_JavaThread_protected(const JavaThread* p)
>> 
>> that returns true when the target JavaThread* is protected and false
>> otherwise. Update JavaThread::get_thread_name() to create a
>> ThreadsListHandle and use the new is_JavaThread_protected(). Also
>> update JvmtiTrace::safe_get_thread_name() to use the new
>> is_JavaThread_protected().
>> 
>> This fix is tested via a Mach5 Tier[1-8] run.
>
> Daniel D. Daugherty has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   Address coleenp CR0 comments.

src/hotspot/share/compiler/compileBroker.cpp line 1008:

> 1006:       if (TraceCompilerThreads) {
> 1007:         ResourceMark rm;
> 1008:         tty->print_cr("Added initial compiler thread %s", 
> ct->get_thread_name());

This code seems potentially broken both before and after this change. If the ct 
thread is protected already (by current call chain) you don't need the lock, if 
it isn't protected then you can't safely call get_thread_name() on it without 
first ensuring it is still a valid reference.

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

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

Reply via email to