JDK-8206954 : Test runtime/Thread/ThreadPriorities.java crashes with SEGV in pthread_getcpuclockid
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 11
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: x86
  • Submitted: 2018-07-10
  • Updated: 2024-03-26
  • Resolved: 2018-07-10
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 11 JDK 12
11 b22Fixed 12Fixed
Related Reports
Relates :  
Relates :  
Description
TBD
Comments
URL: http://hg.openjdk.java.net/jdk/jdk11/rev/46ca5e6b7ed8 User: dholmes Date: 2018-07-10 07:15:18 +0000
10-07-2018

This is caused by the new test added by JDK-8205878. The errant native thread in the new test, whilst still freshly terminated triggers the ESRCH and the new test passes cleanly. But the JavaThread for that will stay around until the VM terminates - as that's what happens if you fail to detach. So when the ThreadPriorities test runs and issues a jstack, that will still find the terminated but still attached thread from the earlier test. Only now the pthread_t points to umapped memory and so the validity check in pthread_getcpuclockid gets a SEGV. Simple fix: run the new test in othervm mode.
10-07-2018

It's possible this may be related to running in AgentVM mode - if there are leftover threads from other tests. Really we want to see the jstack output that was triggered before the crash hit.
10-07-2018

Ran the test 50 times through mach5 - zero failures.
10-07-2018

Looking at the source code for pthread_getcpuclockid the validity check is racing with the thread being validated, so in general it would be possible for the check to pass (hence no ESRCH) and then the thread terminates and the code operates on an invalid pthread_t.
10-07-2018

This is not caused by the changes in JDK-8205878 as far as I can see. The underlying problem is not obvious. A jstack command has been issued against the VM and the AttachListener thread has invoked the VM_PrintThreads operation, which somehow encounters a thread with an invalid pthread Id which does not trigger an ESRCH return from pthread_getcpuclockid, but somehow causes a SEGV. Yet we have no native threads involved that may be terminating without detaching.
10-07-2018

# # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x00007f40b2e90c20, pid=15857, tid=15872 # # JRE version: Java(TM) SE Runtime Environment (12.0) (fastdebug build 12-internal+0-jdk12-jdk.41) # Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 12-internal+0-jdk12-jdk.41, mixed mode, tiered, compressed oops, parallel gc, linux-amd64) # Problematic frame: # C [libpthread.so.0+0xcc20] pthread_getcpuclockid+0x0 # # Core dump will be written. Default location: Core dumps may be processed with "/usr/libexec/abrt-hook-ccpp %s %c %p %u %g %t e" (or dumping to /scratch/opt/mach5/mesos/work_dir/slaves/c4ee7e63-1ded-4e8c-9581-ce26f27e3af4-S432/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/ffc26fd7-f552-4960-adea-c0a72a9f27fb/runs/76af3339-6c32-49c6-9244-b33ce4434c0e/testoutput/jtreg/JTwork/scratch/2/core.15857) # # If you would like to submit a bug report, please visit: # http://bugreport.java.com/bugreport/crash.jsp # --------------- S U M M A R Y ------------ Command Line: -XX:MaxRAMPercentage=8 -XX:+UseParallelGC -XX:+UseParallelOldGC -XX:+UseNUMA -XX:+IgnoreUnrecognizedVMOptions -Djava.library.path=/scratch/opt/mach5/mesos/work_dir/jib-master/install/jdk12-jdk.41/linux-x64-debug.test/hotspot/jtreg/native --patch-module=java.base=/scratch/opt/mach5/mesos/work_dir/slaves/c4ee7e63-1ded-4e8c-9581-ce26f27e3af4-S432/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/ffc26fd7-f552-4960-adea-c0a72a9f27fb/runs/76af3339-6c32-49c6-9244-b33ce4434c0e/testoutput/jtreg/JTwork/patches/java.base -Djava.security.policy=file:/scratch/opt/mach5/mesos/work_dir/slaves/c4ee7e63-1ded-4e8c-9581-ce26f27e3af4-S432/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/ffc26fd7-f552-4960-adea-c0a72a9f27fb/runs/76af3339-6c32-49c6-9244-b33ce4434c0e/testoutput/jtreg/JTwork/jtreg.policy com.sun.javatest.regtest.agent.AgentServer -allowSetSecurityManager -port 36691 Intel(R) Xeon(R) CPU E5-2690 0 @ 2.90GHz, 6 cores, 29G, Oracle Linux Server release 7.1 Time: Mon Jul 9 20:12:47 2018 PDT elapsed time: 2066 seconds (0d 0h 34m 26s) --------------- T H R E A D --------------- Current thread (0x00007f40ac15e000): VMThread "VM Thread" [stack: 0x00007f4090992000,0x00007f4090a92000] [id=15872] Stack: [0x00007f4090992000,0x00007f4090a92000], sp=0x00007f4090a908a8, free space=1018k Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code) C [libpthread.so.0+0xcc20] pthread_getcpuclockid+0x0 V [libjvm.so+0x17b5f66] Thread::print_on(outputStream*, bool) const+0x46 V [libjvm.so+0x17bb2fe] JavaThread::print_on(outputStream*, bool) const+0x13e V [libjvm.so+0x17bf529] Threads::print_on(outputStream*, bool, bool, bool, bool)+0x1c9 V [libjvm.so+0x18c60a2] VM_Operation::evaluate()+0x132 V [libjvm.so+0x18c17ae] VMThread::evaluate_operation(VM_Operation*) [clone .constprop.51]+0x18e V [libjvm.so+0x18c2067] VMThread::loop()+0x4d7 V [libjvm.so+0x18c2673] VMThread::run()+0xd3 V [libjvm.so+0x14d0830] thread_native_entry(Thread*)+0x100 siginfo: si_signo: 11 (SIGSEGV), si_code: 1 (SEGV_MAPERR), si_addr: 0x00007f402f9f19d0 Register to memory mapping: RAX=0x00007f40b2e90c20: pthread_getcpuclockid+0x0000000000000000 in /lib64/libpthread.so.0 at 0x00007f40b2e84000 RBX=0x00007f403c01c000 is a thread RCX=0x0000000000000020 is an unknown value RDX=0x00007f4090a8ffca is an unknown value RSP=0x00007f4090a908a8 is an unknown value RBP=0x00007f4090a908c0 is an unknown value RSI=0x00007f4090a908bc is an unknown value RDI=0x00007f402f9f1700 is pointing into the stack for thread: 0x00007f403c01c000 R8 =0x00007f40b26fbd58: _IO_vfprintf+0x0000000000001808 in /lib64/libc.so.6 at 0x00007f40b26b3000 R9 =0x0000000000000009 is an unknown value R10=0x0 is NULL R11=0x00007f40b28323f0: <offset 0x000000000017f3f0> in /lib64/libc.so.6 at 0x00007f40b26b3000 R12=0x00007f3fcd5d4c80 is pointing into the stack for thread: 0x00007f4070001000 R13=0x0 is NULL R14=0x00007f4090a90938 is an unknown value R15=0x0 is NULL Registers: RAX=0x00007f40b2e90c20, RBX=0x00007f403c01c000, RCX=0x0000000000000020, RDX=0x00007f4090a8ffca RSP=0x00007f4090a908a8, RBP=0x00007f4090a908c0, RSI=0x00007f4090a908bc, RDI=0x00007f402f9f1700 R8 =0x00007f40b26fbd58, R9 =0x0000000000000009, R10=0x0000000000000000, R11=0x00007f40b28323f0 R12=0x00007f3fcd5d4c80, R13=0x0000000000000000, R14=0x00007f4090a90938, R15=0x0000000000000000 RIP=0x00007f40b2e90c20, EFLAGS=0x0000000000010202, CSGSFS=0x0000000000000033, ERR=0x0000000000000004 TRAPNO=0x000000000000000e Top of Stack: (sp=0x00007f4090a908a8) 0x00007f4090a908a8: 00007f40b19980e5 0000000000000000 0x00007f4090a908b8: 00007f4090a90938 00007f4090a90910 0x00007f4090a908c8: 00007f40b1c7ef66 000000000000000c 0x00007f4090a908d8: 00000000cd5d4c80 00007f403c01c000 Instructions: (pc=0x00007f40b2e90c20) 0x00007f40b2e90c00: 48 8d 05 79 9f 20 00 48 85 c0 74 0c 48 8b 0d 6d 0x00007f40b2e90c10: 9f 20 00 e9 58 89 ff ff 31 c9 eb f7 0f 1f 40 00 0x00007f40b2e90c20: 8b 87 d0 02 00 00 85 c0 7e 0e f7 d0 8d 04 c5 06 0x00007f40b2e90c30: 00 00 00 89 06 31 c0 c3 b8 03 00 00 00 c3 66 90 VM_Operation (0x00007f3fcd5d4b60): PrintThreads, mode: safepoint, requested by thread 0x00007f4070001000 --------------- P R O C E S S --------------- Threads class SMR info: _java_thread_list=0x00007f4070002730, length=26, elements={ 0x00007f40ac01c800, 0x00007f40ac174800, 0x00007f40ac177000, 0x00007f40ac1a2800, 0x00007f40ac1a5000, 0x00007f40ac1a8000, 0x00007f40ac1aa800, 0x00007f40ac231000, 0x00007f40ac36a800, 0x00007f40ac43a000, 0x00007f403c01c000, 0x00007f403047e000, 0x00007f40ac24d000, 0x00007f3fec004000, 0x00007f3fec001800, 0x00007f3fec006000, 0x00007f3fec007800, 0x00007f3fec009000, 0x00007f3fec00b000, 0x00007f3fec00c800, 0x00007f3fec00e800, 0x00007f3fec010000, 0x00007f3fec011800, 0x00007f3fec015000, 0x00007f3fec017000, 0x00007f4070001000 } _java_thread_list_alloc_cnt=2531, _java_thread_list_free_cnt=2530, _java_thread_list_max=168, _nested_thread_list_max=1 _tlh_cnt=35848, _tlh_times=2237, avg_tlh_time=0.06, _tlh_time_max=281 _deleted_thread_cnt=1252, _deleted_thread_times=43223, avg_deleted_thread_time=34.52, _deleted_thread_time_max=488 _delete_lock_wait_cnt=0, _delete_lock_wait_max=93 _to_delete_list_cnt=0, _to_delete_list_max=50 Java Threads: ( => current thread ) 0x00007f40ac01c800 JavaThread "main" [_thread_blocked, id=15859, stack(0x00007f40b3371000,0x00007f40b3472000)] 0x00007f40ac174800 JavaThread "Reference Handler" daemon [_thread_blocked, id=15873, stack(0x00007f4090890000,0x00007f4090991000)] 0x00007f40ac177000 JavaThread "Finalizer" daemon [_thread_blocked, id=15874, stack(0x00007f409078f000,0x00007f4090890000)] 0x00007f40ac1a2800 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=15876, stack(0x00007f409068e000,0x00007f409078f000)] 0x00007f40ac1a5000 JavaThread "C2 CompilerThread0" daemon [_thread_blocked, id=15877, stack(0x00007f409058d000,0x00007f409068e000)] 0x00007f40ac1a8000 JavaThread "C1 CompilerThread0" daemon [_thread_blocked, id=15878, stack(0x00007f409048c000,0x00007f409058d000)] 0x00007f40ac1aa800 JavaThread "Sweeper thread" daemon [_thread_blocked, id=15879, stack(0x00007f409038b000,0x00007f409048c000)] 0x00007f40ac231000 JavaThread "Common-Cleaner" daemon [_thread_blocked, id=15880, stack(0x00007f409028a000,0x00007f409038b000)] 0x00007f40ac36a800 JavaThread "Service Thread" daemon [_thread_blocked, id=15881, stack(0x00007f4087168000,0x00007f4087269000)] 0x00007f40ac43a000 JavaThread "pool-1-thread-1" daemon [_thread_blocked, id=15892, stack(0x00007f4086d63000,0x00007f4086e64000)] 0x00007f403c01c000 JavaThread "NewName" daemon [_thread_in_native, id=6846, stack(0x00007f402f1f2000,0x00007f402f9f2000)] 0x00007f403047e000 JavaThread "process reaper" daemon [_thread_in_native, id=5588, stack(0x00007f4084dc8000,0x00007f4084dec000)] 0x00007f40ac24d000 JavaThread "SameVMThread" [_thread_blocked, id=12963, stack(0x00007f40844c1000,0x00007f40845c2000)] 0x00007f3fec004000 JavaThread "Priority=1" [_thread_blocked, id=12964, stack(0x00007f3fccfd0000,0x00007f3fcd0d1000)] 0x00007f3fec001800 JavaThread "Priority=2" [_thread_blocked, id=12965, stack(0x00007f3fcd3d4000,0x00007f3fcd4d5000)] 0x00007f3fec006000 JavaThread "Priority=3" [_thread_blocked, id=12966, stack(0x00007f40847c4000,0x00007f40848c5000)] 0x00007f3fec007800 JavaThread "Priority=4" [_thread_blocked, id=12967, stack(0x00007f402dfe1000,0x00007f402e0e2000)] 0x00007f3fec009000 JavaThread "Priority=5" [_thread_blocked, id=12968, stack(0x00007f402ced0000,0x00007f402cfd1000)] 0x00007f3fec00b000 JavaThread "Priority=6" [_thread_blocked, id=12969, stack(0x00007f402d6d8000,0x00007f402d7d9000)] 0x00007f3fec00c800 JavaThread "Priority=7" [_thread_blocked, id=12970, stack(0x00007f402c4c6000,0x00007f402c5c7000)] 0x00007f3fec00e800 JavaThread "Priority=8" [_thread_blocked, id=12971, stack(0x00007f40845c2000,0x00007f40846c3000)] 0x00007f3fec010000 JavaThread "Priority=9" [_thread_blocked, id=12972, stack(0x00007f40846c3000,0x00007f40847c4000)] 0x00007f3fec011800 JavaThread "Priority=10" [_thread_blocked, id=12973, stack(0x00007f3fcd0d1000,0x00007f3fcd1d2000)] 0x00007f3fec015000 JavaThread "Thread-1099" daemon [_thread_in_native, id=12977, stack(0x00007f3fcd1d2000,0x00007f3fcd2d3000)] 0x00007f3fec017000 JavaThread "Thread-1100" daemon [_thread_in_native, id=12978, stack(0x00007f3fccbcc000,0x00007f3fccccd000)] 0x00007f4070001000 JavaThread "Attach Listener" daemon [_thread_blocked, id=13004, stack(0x00007f3fcd4d5000,0x00007f3fcd5d6000)]
10-07-2018