See https://bugs.openjdk.org/browse/JDK-8302073. Azul ran into problems where we hang during error handling due to recursive mallocs:
```
Thread 127 (Thread 0x7fa4a6fc5700 (LWP 26025)):
#0 0x00007fa5542c27fc in __lll_lock_wait_private () from /lib64/libc.so.6
#1 0x00007fa55423eba2 in _L_lock_16654 () from /lib64/libc.so.6
#2 0x00007fa55423b7e3 in malloc () from /lib64/libc.so.6
#3 0x00007fa550559250 in AllocateHeap(unsigned long, MemoryType, AllocFailStrategy::AllocFailEnum) () from jre/lib/server/libjvm.so
#4 0x00007fa5507b66a4 in Decoder::decode(unsigned char*, char*, int, int*, char const*, bool) () from jre/lib/server/libjvm.so
#5 0x00007fa550ca66ca in os::dll_address_to_function_name(unsigned char*, char*, int, int*, bool) () from jre/lib/server/libjvm.so
#6 0x00007fa55087197c in frame::print_C_frame(outputStream*, char*, int, unsigned char*) () from jre/lib/server/libjvm.so
#7 0x00007fa550f4dadc in VMError::report(outputStream*, bool) () from jre/lib/server/libjvm.so
#8 0x00007fa550f4f8e4 in VMError::report_and_die(int, char const*, char const*, __va_list_tag*, Thread*, unsigned char*, void*, void*, char const*, int, unsigned long) () from jre/lib/server/libjvm.so
#9 0x00007fa550f5071b in VMError::report_and_die(Thread*, unsigned int, unsigned char*, void*, void*, char const*, ...) () from jre/lib/server/libjvm.so
#10 0x00007fa550f5074e in VMError::report_and_die(Thread*, unsigned int, unsigned char*, void*, void*) () from jre/lib/server/libjvm.so
#11 0x00007fa550cb157c in JVM_handle_linux_signal () from jre/lib/server/libjvm.so
#12 0x00007fa550ca3b68 in signalHandler(int, siginfo*, void*) () from jre/lib/server/libjvm.so
#13 <signal handler called>
#14 0x00007fa5542364d1 in malloc_consolidate () from /lib64/libc.so.6
#15 0x00007fa554238135 in _int_malloc () from /lib64/libc.so.6
#16 0x00007fa55423b78c in malloc () from /lib64/libc.so.6
#17 custom JNI code that crashes
```
Should not happen - decoder should, if in any way possible, work with the error handling scratch buffer.
```
Thread 127 (Thread 0x7fa4a6fc5700 (LWP 26025)):
#0 0x00007fa5542c27fc in __lll_lock_wait_private () from /lib64/libc.so.6
#1 0x00007fa55423eba2 in _L_lock_16654 () from /lib64/libc.so.6
#2 0x00007fa55423b7e3 in malloc () from /lib64/libc.so.6
#3 0x00007fa550559250 in AllocateHeap(unsigned long, MemoryType, AllocFailStrategy::AllocFailEnum) () from jre/lib/server/libjvm.so
#4 0x00007fa5507b66a4 in Decoder::decode(unsigned char*, char*, int, int*, char const*, bool) () from jre/lib/server/libjvm.so
#5 0x00007fa550ca66ca in os::dll_address_to_function_name(unsigned char*, char*, int, int*, bool) () from jre/lib/server/libjvm.so
#6 0x00007fa55087197c in frame::print_C_frame(outputStream*, char*, int, unsigned char*) () from jre/lib/server/libjvm.so
#7 0x00007fa550f4dadc in VMError::report(outputStream*, bool) () from jre/lib/server/libjvm.so
#8 0x00007fa550f4f8e4 in VMError::report_and_die(int, char const*, char const*, __va_list_tag*, Thread*, unsigned char*, void*, void*, char const*, int, unsigned long) () from jre/lib/server/libjvm.so
#9 0x00007fa550f5071b in VMError::report_and_die(Thread*, unsigned int, unsigned char*, void*, void*, char const*, ...) () from jre/lib/server/libjvm.so
#10 0x00007fa550f5074e in VMError::report_and_die(Thread*, unsigned int, unsigned char*, void*, void*) () from jre/lib/server/libjvm.so
#11 0x00007fa550cb157c in JVM_handle_linux_signal () from jre/lib/server/libjvm.so
#12 0x00007fa550ca3b68 in signalHandler(int, siginfo*, void*) () from jre/lib/server/libjvm.so
#13 <signal handler called>
#14 0x00007fa5542364d1 in malloc_consolidate () from /lib64/libc.so.6
#15 0x00007fa554238135 in _int_malloc () from /lib64/libc.so.6
#16 0x00007fa55423b78c in malloc () from /lib64/libc.so.6
#17 custom JNI code that crashes
```
Should not happen - decoder should, if in any way possible, work with the error handling scratch buffer.
- relates to
-
JDK-8303861 Error handling step timeouts should never be blocked by OnError and others
- Resolved
-
JDK-8302073 Specifying OnError handler prevents WatcherThread to break a deadlock in report_and_die()
- Closed