首先top看一下那个java进程高,机器上有很多java进程
举个例子 pid是 2507
ps -mp pid -o THREAD,tid,time
ps -mp 2507-o THREAD,tid,time
查看那个线程占用的cpu高
例如 12830
top -p 2507 -H
再次确认一下
转为16进制
printf "%x\n" 12830
321e
kill -3 2507
jstack 2507 |grep 321e -A 30
出现
Unable to open socket file: target process not responding or HotSpot VM not loaded
The -F option can be used when the target process is not responding
java进程不是root用户启动的
切换用户
su - swrun
运行
jstack 2507 |grep 321e -A 30
"pool-12-thread-1" #3781 prio=5 os_prio=0 tid=0x00007f78143a9000 nid=0x321e runnable [0x00007f77c70c3000]
java.lang.Thread.State: RUNNABLE
at java.net.PlainSocketImpl.socketAvailable(Native Method)
at java.net.AbstractPlainSocketImpl.available(AbstractPlainSocketImpl.java:485)
- locked <0x00000005cb097e28> (a java.net.SocksSocketImpl)
at java.net.SocketInputStream.available(SocketInputStream.java:258)
at com.googlecode.lanterna.terminal.ansi.TelnetTerminal$TelnetClientIACFilterer.read(TelnetTerminal.java:253)
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
- locked <0x00000005cc1d0dc8> (a java.io.InputStreamReader)
at java.io.InputStreamReader.read(InputStreamReader.java:184)
at java.io.BufferedReader.fill(BufferedReader.java:161)
at java.io.BufferedReader.read(BufferedReader.java:182)
- locked <0x00000005cc1d0dc8> (a java.io.InputStreamReader)
at com.googlecode.lanterna.input.InputDecoder.getNextCharacter(InputDecoder.java:70)
at com.googlecode.lanterna.terminal.ansi.StreamBasedTerminal.readInput(StreamBasedTerminal.java:196)
- locked <0x00000005cc1ea788> (a java.lang.Object)
at com.googlecode.lanterna.terminal.ansi.StreamBasedTerminal.readInput(StreamBasedTerminal.java:188)
I found root cause because the readInput function is non-blocking
阅读(2527) | 评论(0) | 转发(0) |