java虚拟机线程
2022-01-29 15:25:27
Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.192-b12 mixed mode):
监听各种请求的socket连接,把执行的操作扔给VM Thread
"Attach Listener" #12 daemon prio=9 os_prio=0 tid=0x00007f0d2c001000 nid=0xc5d6 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
Locked ownable synchronizers:
- None
"Thread-3" #11 daemon prio=5 os_prio=0 tid=0x00007f0d9c44a800 nid=0xb885 waiting on condition [0x00007f0d84853000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x0000000581aed3f8> (a java.util.concurrent.locks.ReentrantLock$FairSync)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:836)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:870)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1199)
at java.util.concurrent.locks.ReentrantLock$FairSync.lock(ReentrantLock.java:224)
at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:285)
at org.apache.hive.jdbc.HiveConnection$SynchronizedHandler.invoke(HiveConnection.java:1523)
at com.sun.proxy.$Proxy17.FetchResults(Unknown Source)
at org.apache.hive.jdbc.HiveStatement.getQueryLog(HiveStatement.java:913)
at com.microfun.hive.client.Main.updateQueryLog(Main.java:107)
at com.microfun.hive.client.Main$LogRunnable.run(Main.java:141)
at java.lang.Thread.run(Thread.java:748)
Locked ownable synchronizers:
- None
"Timer-1" #10 daemon prio=5 os_prio=0 tid=0x00007f0d9c1da800 nid=0xb884 in Object.wait() [0x00007f0d84f5e000]
java.lang.Thread.State: TIMED_WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x0000000581e2dfd0> (a java.util.TaskQueue)
at java.util.TimerThread.mainLoop(Timer.java:552)
- locked <0x0000000581e2dfd0> (a java.util.TaskQueue)
at java.util.TimerThread.run(Timer.java:505)
Locked ownable synchronizers:
- None
名为“Service Thread”的线程是 JVM 的内部线程,在 JVM 本机代码中实现。它等待某些内部事件的通知,然后处理它们。根据OpenJDK Java 11 源代码,这些是:
低内存事件
延迟的 JVMTI 事件
GC 通知
JMX Dcmd 通知
字符串表工作项
"Service Thread" #7 daemon prio=9 os_prio=0 tid=0x00007f0d9c0d2000 nid=0xb870 runnable [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
Locked ownable synchronizers:
- None
"C1 CompilerThread1" #6 daemon prio=9 os_prio=0 tid=0x00007f0d9c0b5000 nid=0xb86f waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
Locked ownable synchronizers:
- None
"C2 CompilerThread0" #5 daemon prio=9 os_prio=0 tid=0x00007f0d9c0b2000 nid=0xb86e waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
Locked ownable synchronizers:
- None
当操作系统向 JVM 发出信号时,信号调度线程会将信号传递给适当的处理程序
"Signal Dispatcher" #4 daemon prio=9 os_prio=0 tid=0x00007f0d9c0b0800 nid=0xb86d runnable [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
Locked ownable synchronizers:
- None
垃圾回收守护线程
"Finalizer" #3 daemon prio=8 os_prio=0 tid=0x00007f0d9c07e000 nid=0xb867 in Object.wait() [0x00007f0d86185000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x0000000580108ed0> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:144)
- locked <0x0000000580108ed0> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:165)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:216)
Locked ownable synchronizers:
- None
处理引用对象本身(软、弱、虚引用)的垃圾回收问题
"Reference Handler" #2 daemon prio=10 os_prio=0 tid=0x00007f0d9c07b800 nid=0xb866 in Object.wait() [0x00007f0d86286000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x0000000580106bf8> (a java.lang.ref.Reference$Lock)
at java.lang.Object.wait(Object.java:502)
at java.lang.ref.Reference.tryHandlePending(Reference.java:191)
- locked <0x0000000580106bf8> (a java.lang.ref.Reference$Lock)
at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:153)
Locked ownable synchronizers:
- None
"main" #1 prio=5 os_prio=0 tid=0x00007f0d9c009800 nid=0xb85f runnable [0x00007f0da38d0000]
java.lang.Thread.State: RUNNABLE
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
at java.net.SocketInputStream.read(SocketInputStream.java:171)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:286)
at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
- locked <0x0000000581998c10> (a java.io.BufferedInputStream)
at org.apache.hive.org.apache.thrift.transport.TIOStreamTransport.read(TIOStreamTransport.java:127)
at org.apache.hive.org.apache.thrift.transport.TTransport.readAll(TTransport.java:86)
at org.apache.hive.org.apache.thrift.transport.TSaslTransport.readLength(TSaslTransport.java:376)
at org.apache.hive.org.apache.thrift.transport.TSaslTransport.readFrame(TSaslTransport.java:453)
at org.apache.hive.org.apache.thrift.transport.TSaslTransport.read(TSaslTransport.java:435)
at org.apache.hive.org.apache.thrift.transport.TSaslClientTransport.read(TSaslClientTransport.java:37)
at org.apache.hive.org.apache.thrift.transport.TTransport.readAll(TTransport.java:86)
at org.apache.hive.org.apache.thrift.protocol.TBinaryProtocol.readAll(TBinaryProtocol.java:429)
at org.apache.hive.org.apache.thrift.protocol.TBinaryProtocol.readI32(TBinaryProtocol.java:318)
at org.apache.hive.org.apache.thrift.protocol.TBinaryProtocol.readMessageBegin(TBinaryProtocol.java:219)
at org.apache.hive.org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:77)
at org.apache.hive.service.rpc.thrift.TCLIService$Client.recv_GetOperationStatus(TCLIService.java:467)
at org.apache.hive.service.rpc.thrift.TCLIService$Client.GetOperationStatus(TCLIService.java:454)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.hive.jdbc.HiveConnection$SynchronizedHandler.invoke(HiveConnection.java:1524)
at com.sun.proxy.$Proxy17.GetOperationStatus(Unknown Source)
at org.apache.hive.jdbc.HiveStatement.waitForOperationToComplete(HiveStatement.java:367)
at org.apache.hive.jdbc.HiveStatement.execute(HiveStatement.java:254)
at org.apache.hive.jdbc.HiveStatement.executeUpdate(HiveStatement.java:490)
at com.microfun.hive.client.Main.runStatement(Main.java:251)
at com.microfun.hive.client.Main.run(Main.java:299)
at com.microfun.hive.client.Main.main(Main.java:461)
Locked ownable synchronizers:
- <0x0000000581aed3f8> (a java.util.concurrent.locks.ReentrantLock$FairSync)
线程母体,最原始的线程,单例,里面有个队列,存放上面的操作,它负责loop处理队列中的操作.(包括对其他线程的创建,分配和对象的清理,cms-mark等工作)
"VM Thread" os_prio=0 tid=0x00007f0d9c071800 nid=0xb865 runnable
"GC task thread#0 (ParallelGC)" os_prio=0 tid=0x00007f0d9c01f000 nid=0xb861 runnable
定期的内存监控、JVM运行状况监控
"VM Periodic Task Thread" os_prio=0 tid=0x00007f0d9c0dc800 nid=0xb871 waiting on condition
JNI global references: 22