Action Report 打印阻塞线程

最近网站运行了一段时间之后就莫名的不响应请求了, 这里的请求指的是action 请求, 静态资源还是能访问的。


通过jvm监控工具,获得以下信息。


我分析应该是线程被阻塞了,阻塞的代码就是action  Report 输出时调用的system.out.print


但是不是很明白为什么会阻塞,怎样才能避免这种情况呢。




我写了这么多,怎么提交还提示正文内容太少了,那好吧,下边的就是凑数的

2017-12-01 04:07:31

Full thread dump Java HotSpot(TM) 64-Bit Server VM (24.80-b11 mixed mode):


"RMI TCP Connection(15)-172.18.255.6" daemon prio=6 tid=0x000000000c7d3800 nid=0x2164 runnable [0x000000001491d000]

   java.lang.Thread.State: RUNNABLE

at java.net.SocketInputStream.socketRead0(Native Method)

at java.net.SocketInputStream.read(SocketInputStream.java:152)

at java.net.SocketInputStream.read(SocketInputStream.java:122)

at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)

at java.io.BufferedInputStream.read(BufferedInputStream.java:254)

- locked <0x00000000f4303710> (a java.io.BufferedInputStream)

at java.io.FilterInputStream.read(FilterInputStream.java:83)

at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:549)

at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:828)

at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.access$400(TCPTransport.java:619)

at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$1.run(TCPTransport.java:684)

at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$1.run(TCPTransport.java:681)

at java.security.AccessController.doPrivileged(Native Method)

at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:681)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

at java.lang.Thread.run(Thread.java:745)


   Locked ownable synchronizers:

- <0x00000000ec793630> (a java.util.concurrent.ThreadPoolExecutor$Worker)


"http-apr-80-exec-3" daemon prio=6 tid=0x000000000d50e000 nid=0x12e4 runnable [0x00000000127ee000]

   java.lang.Thread.State: RUNNABLE

at java.io.FileOutputStream.writeBytes(Native Method)

at java.io.FileOutputStream.write(FileOutputStream.java:345)

at java.io.BufferedOutputStream.write(BufferedOutputStream.java:122)

- locked <0x00000000c0392f00> (a java.io.BufferedOutputStream)

at java.io.PrintStream.write(PrintStream.java:480)

- locked <0x00000000c0392ee0> (a java.io.PrintStream)

at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)

at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291)

at sun.nio.cs.StreamEncoder.flushBuffer(StreamEncoder.java:104)

- locked <0x00000000c0393038> (a java.io.OutputStreamWriter)

at java.io.OutputStreamWriter.flushBuffer(OutputStreamWriter.java:185)

at java.io.PrintStream.write(PrintStream.java:527)

- locked <0x00000000c0392ee0> (a java.io.PrintStream)

at java.io.PrintStream.print(PrintStream.java:669)

at org.apache.tomcat.util.log.SystemLogHandler.print(SystemLogHandler.java:214)

at com.jfinal.core.ActionReporter$SystemOutWriter.write(ActionReporter.java:141)

at com.jfinal.core.ActionReporter.report(ActionReporter.java:133)

at com.jfinal.core.ActionHandler.handle(ActionHandler.java:75)

at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:73)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)

at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)

at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)

at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2441)

at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2430)

- locked <0x00000000f8200370> (a org.apache.tomcat.util.net.AprEndpoint$AprSocketWrapper)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

at java.lang.Thread.run(Thread.java:745)


   Locked ownable synchronizers:

- <0x00000000c2791c60> (a java.util.concurrent.ThreadPoolExecutor$Worker)

"http-apr-80-exec-59" daemon prio=6 tid=0x000000000d509800 nid=0x1ba8 waiting for monitor entry [0x00000000134fe000]

   java.lang.Thread.State: BLOCKED (on object monitor)

at java.io.PrintStream.write(PrintStream.java:524)

- waiting to lock <0x00000000c0392ee0> (a java.io.PrintStream)

at java.io.PrintStream.print(PrintStream.java:669)

at org.apache.tomcat.util.log.SystemLogHandler.print(SystemLogHandler.java:214)

at com.jfinal.core.ActionReporter$SystemOutWriter.write(ActionReporter.java:141)

at com.jfinal.core.ActionReporter.report(ActionReporter.java:133)

at com.jfinal.core.ActionHandler.handle(ActionHandler.java:75)

at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:73)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)

at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)

at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)

at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2441)

at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2430)

- locked <0x00000000ebcfd120> (a org.apache.tomcat.util.net.AprEndpoint$AprSocketWrapper)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

at java.lang.Thread.run(Thread.java:745)


   Locked ownable synchronizers:

- <0x00000000ebcfd2d0> (a java.util.concurrent.ThreadPoolExecutor$Worker)


"http-apr-80-exec-54" daemon prio=6 tid=0x000000000d506800 nid=0x142c waiting for monitor entry [0x00000000140fe000]

   java.lang.Thread.State: BLOCKED (on object monitor)

at java.io.PrintStream.write(PrintStream.java:524)

- waiting to lock <0x00000000c0392ee0> (a java.io.PrintStream)

at java.io.PrintStream.print(PrintStream.java:669)

at org.apache.tomcat.util.log.SystemLogHandler.print(SystemLogHandler.java:214)

at com.jfinal.core.ActionReporter$SystemOutWriter.write(ActionReporter.java:141)

at com.jfinal.core.ActionReporter.report(ActionReporter.java:133)

at com.jfinal.core.ActionHandler.handle(ActionHandler.java:75)

at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:73)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)

at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)

at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)

at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2441)

at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2430)

- locked <0x00000000f81440c0> (a org.apache.tomcat.util.net.AprEndpoint$AprSocketWrapper)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

at java.lang.Thread.run(Thread.java:745)


   Locked ownable synchronizers:

- <0x00000000f81f7588> (a java.util.concurrent.ThreadPoolExecutor$Worker)


"http-apr-80-exec-50" daemon prio=6 tid=0x000000000de1b000 nid=0x1dd8 waiting for monitor entry [0x000000001322e000]

   java.lang.Thread.State: BLOCKED (on object monitor)

at java.io.PrintStream.write(PrintStream.java:524)

- waiting to lock <0x00000000c0392ee0> (a java.io.PrintStream)

at java.io.PrintStream.print(PrintStream.java:669)

at org.apache.tomcat.util.log.SystemLogHandler.print(SystemLogHandler.java:214)

at com.jfinal.core.ActionReporter$SystemOutWriter.write(ActionReporter.java:141)

at com.jfinal.core.ActionReporter.report(ActionReporter.java:133)

at com.jfinal.core.ActionHandler.handle(ActionHandler.java:75)

at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:73)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)

at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)

at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)

at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2441)

at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2430)

- locked <0x00000000f81580d0> (a org.apache.tomcat.util.net.AprEndpoint$AprSocketWrapper)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

at java.lang.Thread.run(Thread.java:745)


   Locked ownable synchronizers:

- <0x00000000f81fe500> (a java.util.concurrent.ThreadPoolExecutor$Worker)


"http-apr-80-exec-48" daemon prio=6 tid=0x000000000de1a000 nid=0x10dc waiting for monitor entry [0x000000001456e000]

   java.lang.Thread.State: BLOCKED (on object monitor)

at java.io.PrintStream.write(PrintStream.java:524)

- waiting to lock <0x00000000c0392ee0> (a java.io.PrintStream)

at java.io.PrintStream.print(PrintStream.java:669)

at org.apache.tomcat.util.log.SystemLogHandler.print(SystemLogHandler.java:214)

at com.jfinal.core.ActionReporter$SystemOutWriter.write(ActionReporter.java:141)

at com.jfinal.core.ActionReporter.report(ActionReporter.java:133)

at com.jfinal.core.ActionHandler.handle(ActionHandler.java:75)

at com.jfinal.plugin.druid.DruidStatViewHandler.handle(DruidStatViewHandler.java:75)

at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:73)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)

at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)

at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)

at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)

at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2441)

at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2430)

- locked <0x00000000f816e320> (a org.apache.tomcat.util.net.AprEndpoint$AprSocketWrapper)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

at java.lang.Thread.run(Thread.java:745)


   Locked ownable synchronizers:

- <0x00000000f81feb28> (a java.util.concurrent.ThreadPoolExecutor$Worker)


评论区

快乐的蹦豆子

2017-12-01 15:37

就是很多线程在waiting to lock <0x00000000c0392ee0>

快乐的蹦豆子

2017-12-01 15:38

除了这个地方 jsprender 的render在高并发下也会被阻塞

快乐的蹦豆子

2017-12-01 15:39

request.getRequestDispatcher(view).forward(request, response);这个地方

快乐的蹦豆子

2017-12-01 15:59

所谓的高并发就是我用东西压着F5Y一直刷新

JFinal

2017-12-01 17:49

action report 仅用于开发阶段输出一些有利于开发的指示性信息,生产环境要关闭这个 me.setDevMode(false);

你碰到的情况我也是头一回碰到,System.out.print 终归是要向某处输出数据,可能是这个输出的目标有问题,建议关闭开发模式测试一下

也可尝试一下 ActionReporter.setWriter(...) 将输出定向到别处去

快乐的蹦豆子

2017-12-02 20:18

.关了这个确实可以了,那个jsprender在高并发时候也就死锁,我把tomcat线程数和内存调大了就没再出现

热门反馈

扫码入社