JDK-8167421 : AArch64: in one core system, fatal error: Illegal threadstate encountered
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 9
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: aarch64
  • Submitted: 2016-10-10
  • Updated: 2021-02-01
  • Resolved: 2016-10-19
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 9 Other
9 b146Fixed openjdk8u292Fixed
Related Reports
Relates :  
Description
Running tomcat on single cpu machine, it crash in SafepointSynchronize::block because thread state is _thread_in_native, expected status is _thread_in_native_trans

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (safepoint.cpp:716), pid=4329, tid=0x0000ffff89204200
#  fatal error: Illegal threadstate encountered: 4
#
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

---------------  T H R E A D  ---------------

Current thread (0x0000ffff684fe000):  JavaThread "localhost-startStop-1" daemon [_thread_in_native, id=4341, stack(0x0000ffff89005000,0x0000ffff89205000)]

Stack: [0x0000ffff89005000,0x0000ffff89205000],  sp=0x0000ffff89201f60,  free space=2035k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x95ed3c]  VMError::report_and_die()+0x130
V  [libjvm.so+0x42c04c]  report_fatal(char const*, int, char const*)+0x60
V  [libjvm.so+0x85bae4]  SafepointSynchronize::block(JavaThread*) [clone .part.24]+0x50
V  [libjvm.so+0x90381c]  JavaThread::check_safepoint_and_suspend_for_native_trans(JavaThread*)+0x1c8
V  [libjvm.so+0x903f58]  JavaThread::check_special_condition_for_native_trans(JavaThread*)+0x14
J 236  java.util.zip.ZipFile.getEntry(J[BZ)J (0 bytes) @ 0x0000ffff7c1e64f0 [0x0000ffff7c1e63c0+0x130]
J 1167 C1 java.util.jar.JarFile$JarEntryIterator.hasMoreElements()Z (5 bytes) @ 0x0000ffff7c4f1320 [0x0000ffff7c4f1180+0x1a0]
J 840 C1 java.util.jar.JarFile.getInputStream(Ljava/util/zip/ZipEntry;)Ljava/io/InputStream; (89 bytes) @ 0x0000ffff7c402b54 [0x0000ffff7c402180+0x9d4]
J 1187 C1 org.apache.tomcat.util.scan.FileUrlJar.getEntryInputStream()Ljava/io/InputStream; (21 bytes) @ 0x0000ffff7c52a640 [0x0000ffff7c52a4c0+0x180]

thread state is not correctly maintained when compile JNI wrapper

  __ mov(rscratch1, _thread_in_native_trans);

  if(os::is_MP()) {
    if (UseMembar) {
      __ strw(rscratch1, Address(rthread, JavaThread::thread_state_offset()));

      // Force this write out before the read below
      __ dmb(Assembler::SY);
    } else {
      __ lea(rscratch2, Address(rthread, JavaThread::thread_state_offset()));
      __ stlrw(rscratch1, rscratch2);

      // Write serialization page so VM thread can do a pseudo remote membar.
      // We use the current thread pointer to calculate a thread specific
      // offset to write to within the page. This minimizes bus traffic
      // due to cache line collision.
      __ serialize_memory(rthread, r2);
    }
  }


Comments
Error in ./cpu/aarch64/vm/sharedRuntime_aarch64.cpp. The store should be outside the "if is_MP()" check - as per ./cpu/aarch64/vm/templateInterpreterGenerator_aarch64.cpp
10-10-2016