-
Bug
-
Resolution: Not an Issue
-
P4
-
13
The VM calls IdealGraphPrinter::cleanup() at the final safepoint as the VM terminates, to end the XML stream. This seems to happen with no problem when termination is due to the last non-daemon thread exiting.
The cleanup() call is missing when the VM terminates via System.exit. When we tried to add that as part ofJDK-8222534:
@@ -467,10 +482,18 @@
set_vm_exited();
+ // Clean up ideal graph printers - Compiler threads will be
+ // blocked by the current safepoint.
+#if defined(COMPILER2) && !defined(PRODUCT)
+ IdealGraphPrinter::clean_up();
+#endif
+
// cleanup globals resources before exiting. exit_globals() currently
// cleans up outputStream resources and PerfMemory resources.
exit_globals();
we encountered a crash when running with:
-XX:PrintIdealGraphFile=tmp.xml -XX:+PrintIdealGraph -XX:PrintIdealGraphLevel=4
# Internal Error (open/src/hotspot/share/utilities/xmlstream.cpp:184), pid=32637, tid=32644
# assert((!inside_attrs()) || VMError::is_error_reported()) failed: cannot close element inside attrs
#
It seems a compiler thread was already in the middle of writing a chunk of XML when it was stopped by the terminal safepoint. Examining tmp.xml we see the final entry is:
<method
which traces back to
void IdealGraphPrinter::print_method(ciMethod *method, int bci, InlineTree *tree) {
begin_head(METHOD_ELEMENT);
stringStream str;
method->print_name(&str);
and we then find the problem in:
void ciMethod::print_name(outputStream* st) {
check_is_loaded();
GUARDED_VM_ENTRY(get_Method()->print_name(st);)
}
as the guarded entry can lead to safepoint blocking.
The problem should be reproducible in the last non-daemon thread termination case if we have a daemon thread alive that is still triggering compilation.
The cleanup() call is missing when the VM terminates via System.exit. When we tried to add that as part of
@@ -467,10 +482,18 @@
set_vm_exited();
+ // Clean up ideal graph printers - Compiler threads will be
+ // blocked by the current safepoint.
+#if defined(COMPILER2) && !defined(PRODUCT)
+ IdealGraphPrinter::clean_up();
+#endif
+
// cleanup globals resources before exiting. exit_globals() currently
// cleans up outputStream resources and PerfMemory resources.
exit_globals();
we encountered a crash when running with:
-XX:PrintIdealGraphFile=tmp.xml -XX:+PrintIdealGraph -XX:PrintIdealGraphLevel=4
# Internal Error (open/src/hotspot/share/utilities/xmlstream.cpp:184), pid=32637, tid=32644
# assert((!inside_attrs()) || VMError::is_error_reported()) failed: cannot close element inside attrs
#
It seems a compiler thread was already in the middle of writing a chunk of XML when it was stopped by the terminal safepoint. Examining tmp.xml we see the final entry is:
<method
which traces back to
void IdealGraphPrinter::print_method(ciMethod *method, int bci, InlineTree *tree) {
begin_head(METHOD_ELEMENT);
stringStream str;
method->print_name(&str);
and we then find the problem in:
void ciMethod::print_name(outputStream* st) {
check_is_loaded();
GUARDED_VM_ENTRY(get_Method()->print_name(st);)
}
as the guarded entry can lead to safepoint blocking.
The problem should be reproducible in the last non-daemon thread termination case if we have a daemon thread alive that is still triggering compilation.