我该如何处理过多的CLOSE_WAIT,它们会堵塞Solr

时间:2015-06-26 17:22:26

标签: solr solrcloud solr5

我在SolrCloud模式下运行Solr 5.1,并为很多文档编制索引。它运行良好一段时间,但后来我无法通过HTTP接口连接。

过多的TCP连接似乎已打开。我在Solr面前放了一个Nginx反向代理。 Nginx报告有大约300个开放连接,但solr有大约29,000个。即使Nginx关闭连接,Solr也会保持打开状态。

在Solr日志中,我反复看到以下内容:

  

无法写回复,客户端关闭连接或我们正在关闭   org.eclipse.jetty.io.EofException       在org.eclipse.jetty.http.HttpGenerator.flushBuffer(HttpGenerator.java:914)       在org.eclipse.jetty.http.AbstractGenerator.flush(AbstractGenerator.java:443)       在org.eclipse.jetty.server.HttpOutput.flush(HttpOutput.java:100)       at org.eclipse.jetty.server.AbstractHttpConnection $ Output.flush(AbstractHttpConnection.java:1094)       at sun.nio.cs.StreamEncoder.implFlush(Unknown Source)       在sun.nio.cs.StreamEncoder.flush(未知来源)       在java.io.OutputStreamWriter.flush(未知来源)       在org.apache.solr.util.FastWriter.flush(FastWriter.java:137)       at org.apache.solr.response.QueryResponseWriterUtil.writeQueryResponse(QueryResponseWriterUtil.java:54)       at org.apache.solr.servlet.SolrDispatchFilter.writeResponse(SolrDispatchFilter.java:815)       在org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:455)       在org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:220)       在org.eclipse.jetty.servlet.ServletHandler $ CachedChain.doFilter(ServletHandler.java:1419)       在org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:455)       在org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)       在org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)       在org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)       在org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1075)       在org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:384)       在org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)       在org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1009)       在org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)       at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)       在org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)       在org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)       在org.eclipse.jetty.server.Server.handle(Server.java:368)       at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)       at org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:53)       at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:953)       at org.eclipse.jetty.server.AbstractHttpConnection $ RequestHandler.content(AbstractHttpConnection.java:1014)       在org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:861)       在org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)       at org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:72)       在org.eclipse.jetty.server.bio.SocketConnector $ ConnectorEndPoint.run(SocketConnector.java:264)       在org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)       在org.eclipse.jetty.util.thread.QueuedThreadPool $ 3.run(QueuedThreadPool.java:543)       在java.lang.Thread.run(未知来源)   引起:java.net.SocketException:管道损坏       at java.net.SocketOutputStream.socketWrite0(Native Method)       在java.net.SocketOutputStream.socketWrite(未知来源)       在java.net.SocketOutputStream.write(未知来源)       在org.eclipse.jetty.io.ByteArrayBuffer.writeTo(ByteArrayBuffer.java:375)       在org.eclipse.jetty.io.bio.StreamEndPoint.flush(StreamEndPoint.java:164)       在org.eclipse.jetty.io.bio.StreamEndPoint.flush(StreamEndPoint.java:194)       在org.eclipse.jetty.http.HttpGenerator.flushBuffer(HttpGenerator.java:838)       ......还有36个

如何修复Solr?我是否需要调整Jetty设置。

1 个答案:

答案 0 :(得分:0)

问题是我立即承诺每笔交易。当我将其改为仅每10分钟提交一次时,就解决了这个问题。