RFR: 8282172: CompileBroker::log_metaspace_failure is called from non-Java/compiler threads [v2]
Thomas Stuefe
stuefe at openjdk.java.net
Fri Feb 25 09:30:01 UTC 2022
On Wed, 23 Feb 2022 17:08:31 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
>> In several places in hotspot, we call CompileBroker::log_metaspace_failure(). I believe the intent is to call it from compiler threads only, because it ends up calling:
>>
>>
>> void log_metaspace_failure(const char* reason) {
>> ResourceMark rm;
>> StringLogMessage lm;
>> lm.print("%4d COMPILE PROFILING SKIPPED: %s", -1, reason);
>> lm.print("\n");
>> log(JavaThread::current(), "%s", (const char*)lm);
>> }
>>
>>
>> ...which would fail the cast in `JavaThread::current()` if current thread is not Java thread (compiler threads are Java threads too).
>>
>> It clearly manifests on [JDK-8282170](https://bugs.openjdk.java.net/browse/JDK-8282170) test:
>>
>>
>> 12700 breakpoints set
>> 12800 breakpoints set
>> 12900 breakpoints set
>> 13000 breakpoints set
>> # To suppress the following error report, specify this argument
>> # after -XX: or in .hotspotrc: SuppressErrorAt=/thread.hpp:1458
>> #
>> # A fatal error has been detected by the Java Runtime Environment:
>> #
>> # Internal Error (/home/shade/trunks/jdk/src/hotspot/share/runtime/thread.hpp:1458), pid=889379, tid=889389
>> # assert(t->is_Java_thread()) failed: incorrect cast to JavaThread
>> V [libjvm.so+0xacfad4] CompilationLog::log_metaspace_failure(char const*)+0x494
>> V [libjvm.so+0xac84b0] CompileBroker::log_metaspace_failure()+0x20
>> V [libjvm.so+0x15069e9] Method::build_method_counters(Thread*, Method*)+0x119
>> V [libjvm.so+0x150851b] BreakpointInfo::set(Method*)+0xfb
>> V [libjvm.so+0x127d5ea] JvmtiBreakpoint::each_method_version_do(void (Method::*)(int))+0x5a
>> V [libjvm.so+0x1b342ae] VM_Operation::evaluate()+0x18e
>>
>>
>> Additional testing:
>> - [x] Linux x86_64 fastdebug does not fail JDK-8282170 test anymore
>
> Aleksey Shipilev 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 three additional commits since the last revision:
>
> - Another fix
> - Merge branch 'master' into JDK-8282172-compiler-broker-message
> - Fix
AFAICS FormatStringEventLog::log() - which is only used from the compiler btw - is always called with the current thread. Maybe it should just use Thread::current instead?
-------------
PR: https://git.openjdk.java.net/jdk/pull/7555
More information about the hotspot-compiler-dev
mailing list