Tomcat 8.5.23是否正在泄漏套接字?

时间:2018-07-19 16:19:57

标签: tomcat nio

具有HTTP NIO连接器的Amazon linux上的Tomcat 8.5.23。

工作几天后,tomcat进程已达到打开文件的总数(256.000)。这些是catalina.out中跟踪的很多错误。

我们的应用程序有几个队列,在某些情况下,传入的请求被阻止(在其他情况下,也被正确唤醒)。我们的Tomcat具有MaxThreads =“ 500”。

我们看到的是:

  1. 如果这些队列阻塞了500个以上的请求,则Tomcat没有可用的线程。发生这种情况时,打开文件的数量似乎增加了,并且没有再次减少(因此似乎是泄漏)。

  2. 如果我们将队列的总大小保持在500以下(现在为250),则一切正常。

因此我们不确定传入请求即将到来时Tomcat是否正在泄漏套接字并发现所有tomcat线程都处于忙碌状态。

在某些登录到“ catalina.out”中的跟踪消息下面,即使它们可以提供帮助,也可以:

  1. 在Tomcat运行时出现前3条跟踪:

    2018年7月1日17:07:51.745严重[http-nio-80-exec-591] org.apache.tomcat.util.net.NioEndpoint $ SocketProcessor.doRun  java.lang.NullPointerException         在org.apache.coyote.http11.Http11InputBuffer.recycle(Http11InputBuffer.java:280)         在org.apache.coyote.http11.Http11Processor.recycle(Http11Processor.java:1709)         在org.apache.coyote.AbstractProtocol $ ConnectionHandler.release(AbstractProtocol.java:1050)         在org.apache.coyote.AbstractProtocol $ ConnectionHandler.process(AbstractProtocol.java:1018)         在org.apache.tomcat.util.net.NioEndpoint $ SocketProcessor.doRun(NioEndpoint.java:1459)         在org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)         在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)         在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:624)         在org.apache.tomcat.util.threads.TaskThread $ WrappingRunnable.run(TaskThread.java:61)         在java.lang.Thread.run(Thread.java:748)


01-Jul-2018 17:08:58.755 INFORMACIÓN [http-nio-80-exec-767] org.apache.catalina.connector.CoyoteAdapter.checkRecycled Encountered a non-recycled request and recycled it forcedly.
 org.apache.catalina.connector.CoyoteAdapter$RecycleRequiredException
        at org.apache.catalina.connector.CoyoteAdapter.checkRecycled(CoyoteAdapter.java:501)
        at org.apache.coyote.http11.Http11Processor.recycle(Http11Processor.java:1707)
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.release(AbstractProtocol.java:1050)
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:1018)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)
        at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:748)

02-Jul-2018 11:28:01.566 GRAVE [http-nio-80-exec-15] org.apache.coyote.AbstractProtocol$ConnectionHandler.process Error leyendo requerimiento, ignorado
 java.lang.IllegalStateException: Calling [asyncOperation()] is not valid for a request with Async state [READ_WRITE_OP]
        at org.apache.coyote.AsyncStateMachine.asyncOperation(AsyncStateMachine.java:254)
        at org.apache.coyote.AbstractProcessor.dispatchNonBlockingRead(AbstractProcessor.java:505)
        at org.apache.coyote.AbstractProcessor.dispatch(AbstractProcessor.java:200)
        at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:53)
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)
  1. 当服务器没有可用的处理程序(达到最大打开文件数)时,将出现以下跟踪:

    2018年7月19日13:21:40.990严重[http-nio-80-ClientPoller-1] org.apache.tomcat.util.net.NioEndpoint $ PollerEvent.run无法从轮询器向选择器注册套接字  java.lang.NullPointerException         在sun.nio.ch.EPollArrayWrapper.isEventsHighKilled(EPollArrayWrapper.java:174)         在sun.nio.ch.EPollArrayWrapper.setUpdateEvents(EPollArrayWrapper.java:190)         在sun.nio.ch.EPollArrayWrapper.add(EPollArrayWrapper.java:239)         在sun.nio.ch.EPollSelectorImpl.implRegister(EPollSelectorImpl.java:178)         在sun.nio.ch.SelectorImpl.register(SelectorImpl.java:132)         在java.nio.channels.spi.AbstractSelectableChannel.register(AbstractSelectableChannel.java:212)         在org.apache.tomcat.util.net.NioEndpoint $ PollerEvent.run(NioEndpoint.java:567)         在org.apache.tomcat.util.net.NioEndpoint $ Poller.events(NioEndpoint.java:682)         在org.apache.tomcat.util.net.NioEndpoint $ Poller.run(NioEndpoint.java:813)         在java.lang.Thread.run(Thread.java:748)

  2. 当我们停止无响应的tomcat时,就会出现此消息:

    2018年6月29日10:31:12.143 GRAVE [http-nio-80-exec-727] org.apache.catalina.connector.CoyoteAdapter.asyncDispatch处理异步请求时发生异常  java.lang.NullPointerException         在org.apache.catalina.connector.CoyoteAdapter.asyncDispatch(CoyoteAdapter.java:220)         在org.apache.coyote.AbstractProcessor.dispatch(AbstractProcessor.java:225)         在org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:49)         在org.apache.coyote.AbstractProtocol $ ConnectionHandler.process(AbstractProtocol.java:868)         在org.apache.tomcat.util.net.NioEndpoint $ SocketProcessor.doRun(NioEndpoint.java:1459)         在org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)         在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)         在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:624)         在org.apache.tomcat.util.threads.TaskThread $ WrappingRunnable.run(TaskThread.java:61)         在java.lang.Thread.run(Thread.java:748)

此外,lsof显示了这种状态下的数千个连接:

java    5617 root 5884u  sock                0,7        0t0 185496425 can't identify protocol

希望这会有所帮助。

0 个答案:

没有答案