java.io.IOException: Socket read failed

heavan2010 发布于 2014/10/16 17:29
阅读 3K+
收藏 1

下面是apache请求的日志:有两个是400,一个是200. tomcat 中报的异常信息为socket read failed.不知道什么原因导致的这个问题,其他服务器没有这个问题。原来这台服务器也是正常的,突然从某一天变多的。烦请同行前辈指点迷津。下面是对应的日志信息

221.182.62.155 - - [16/Oct/2014:16:58:33 +0800] "POST /d.do HTTP/1.1" 400 - "-" "application/octet-stream" "-" "1984" "Apache-HttpClient/UNAVAILABLE (java 1.4)" "-" "-" 6284

117.136.47.84 - - [16/Oct/2014:16:58:24 +0800] "POST /d.do HTTP/1.1" 400 - "-" "application/octet-stream" "-" "336" "Apache-HttpClient/UNAVAILABLE (java 1.4)" "-" "-" 4584

218.202.106.201 - - [16/Oct/2014:16:58:22 +0800] "POST /d.do HTTP/1.1" 200 16 "-" "application/octet-stream" "-" "992" "Apache-HttpClient/UNAVAILABLE (java 1.4)" "-" "-" 5062

下面是异常信息

java.io.IOException: Socket read failed
        at org.apache.coyote.ajp.AjpAprProcessor.read(AjpAprProcessor.java:328)
        at org.apache.coyote.ajp.AjpAprProcessor.readMessage(AjpAprProcessor.java:424)
        at org.apache.coyote.ajp.AjpAprProcessor.receive(AjpAprProcessor.java:383)
        at org.apache.coyote.ajp.AbstractAjpProcessor.refillReadBuffer(AbstractAjpProcessor.java:657)
        at org.apache.coyote.ajp.AbstractAjpProcessor$SocketInputBuffer.doRead(AbstractAjpProcessor.java:1135)
        at org.apache.coyote.Request.doRead(Request.java:422)
        at org.apache.catalina.connector.InputBuffer.realReadBytes(InputBuffer.java:290)
        at org.apache.tomcat.util.buf.ByteChunk.substract(ByteChunk.java:449)
        at org.apache.catalina.connector.InputBuffer.read(InputBuffer.java:315)
        at org.apache.catalina.connector.CoyoteInputStream.read(CoyoteInputStream.java:167)
        at com.eyumob.cpa.cpa.domain.query.parserhandler.InitParamTool.initQueryDomain(InitParamTool.java:223)
        at com.eyumob.cpa.cpa.controller.CPAController.gps(CPAController.java:54)
        at sun.reflect.GeneratedMethodAccessor171.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
        at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:436)
        at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:424)
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
        at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
        at org.apache.coyote.ajp.AjpAprProcessor.process(AjpAprProcessor.java:197)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
        at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2430)
        at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2419)
        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:724)



加载中
0
heavan2010
heavan2010

该问题已经解决,解决思路:其他服务器正常说明是该服务器配置的问题,查询配置是第一步。如果配置文件没有找出,直接使用下面的方法进行处理。

1、更换mode_jk 验证是否是mode_jk导致的问题

2、使用tomcat直接提供服务,可以验证是否为apache导致的问题

3、使用Ngix替换apache直接验证上面两种猜想(我这边采用的这种方式)

使用Ngix替换apache后,服务正常了。问题就很明显了,问题一定出在了apache上了。过程中参考了http://serverfault.com/questions/389834/ioexception-socket-read-failed-using-apache-2-mod-jk-and-tomcat-over-ajp

0
首席搬砖工程师
首席搬砖工程师
我几个月前也遇到同样的问题,最后是将apache用mode_jk换成http转发的方式解决,不知道你有没有深究为什么mode_jk会导致这个问题
返回顶部
顶部