JDK-8259392 : Zero error reporting is broken after JDK-8255711
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 16,17
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-01-07
  • Updated: 2021-03-09
  • Resolved: 2021-01-11
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 16 JDK 17
16.0.1Fixed 17 b05Fixed
Related Reports
Relates :  
Description
This manifests on the following tests:

runtime/ErrorHandling/ErrorFileRedirectTest.java
runtime/ErrorHandling/SecondaryErrorTest.java
runtime/memory/ReadFromNoaccessArea.java
runtime/Unsafe/InternalErrorTest.java
runtime/Safepoint/TestAbortVMOnSafepointTimeout.java

00:17:25 #  Internal Error (/home/shade/trunks/jdk/src/hotspot/os_cpu/linux_zero/os_linux_zero.cpp:94), pid=739632, tid=739633
00:17:25 #  Error: ShouldNotCall()

address os::Posix::ucontext_get_pc(const ucontext_t* uc) {
  ShouldNotCallThis(); <---- crash here
  return NULL; // silence compile warnings
}

I believe the generification in JDK-8255711 applies to Zero awkwardly. 

Zero is awkward in the sense it is too generic for its own good. It does not have any access to crash context decoders, and that is why ucontext_* are ShouldNotCallThis()-ed. Before JDK-8255711, Zero error reporting code was specially crafted to avoid this, apparently.

There are at least two problems:
 1. ucontext_get_pc in unimplemented, so we can special-case those for Zero. Instead of returning a bogus value from Zero implementation, I decided to just special-case at its critical use in error reporting.
 2. generic VMError::report_and_die circles back at Zero's unimplemented os::fetch_frame_from_context. Before JDK-8255711, Zero did fatal() that avoided this trouble. The patch ignores the context to match that behavior.
Comments
Fix Request (16u) This resolves the JDK 16 regression in Zero, manifesting during the error reporting. Patch applies cleanly to 16u, affected tests now pass.
02-03-2021

Changeset: bb247b02 Author: Aleksey Shipilev <shade@openjdk.org> Date: 2021-01-11 07:32:57 +0000 URL: https://git.openjdk.java.net/jdk/commit/bb247b02
11-01-2021