Before saying this mistake, I first introduced the background, our project uses the Springboot frame, the integration hprose+spring+mybatis,hprose is what, may refer to my last article to the Hprose a brief introduction. The current project business is to crawl a website for nearly 5 years of football basketball odds data. So this is a big cycle by date. In the Hprose feature, the processing time of the Hprose server is particularly long, which is a key point.
In the Linux environment, our program encountered an error when fetching data on the project line, as follows:
2016-06-16 12:47:52.190 WARN 10150---[http-nio-8082-exec-2] o.a.commons.httpclient.httpmethodbase:going to Buffer Response body of large or unknown size. Using Getresponsebodyasstream instead is recommended.2016-06-16 12:52:30.077 WARN 10150---[http-nio-8082-exec-3] O.apa Che.catalina.core.AsyncContextImpl:onTimeout () failed for listener of type [ Org.apache.catalina.core.asynclistenerwrapper]java.lang.nullpointerexception:null at Hprose.server.HproseService . GetErrorMessage (hproseservice.java:512) at Hprose.server.HproseService.sendError (hproseservice.java:522) at Hprose.server.hprosehttpservice$1.ontimeout (hprosehttpservice.java:208) at Org.apache.catalina.core.AsyncListenerWrapper.fireOnTimeout (asynclistenerwrapper.java:40) at Org.apache.catalina.core.AsyncContextImpl.timeout (asynccontextimpl.java:155) at Org.apache.catalina.connector.CoyoteAdapter.asyncDispatch (coyoteadapter.java:292) at Org.apache.coyote.http11.AbstractHTtp11processor.asyncdispatch (abstracthttp11processor.java:1715) at org.apache.coyote.abstractprotocol$ Abstractconnectionhandler.process (abstractprotocol.java:652) at org.apache.tomcat.util.net.nioendpoint$ Socketprocessor.dorun (nioendpoint.java:1500) at Org.apache.tomcat.util.net.nioendpoint$socketprocessor.run ( nioendpoint.java:1456) at Java.util.concurrent.ThreadPoolExecutor.runWorker (threadpoolexecutor.java:1142) at Java.util.concurrent.threadpoolexecutor$worker.run (threadpoolexecutor.java:617) at Org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run (taskthread.java:61) at Java.lang.Thread.run ( thread.java:745) 2016-06-16 12:52:30.084 INFO 10150---[http-nio-8082-exec-3] o.a.c.c.c.[tomcat]. [localhost]. [/]: Initializing Spring frameworkservlet ' springmvc ' 2016-06-16 12:52:30.084 INFO 10150---[http-nio-8082-exec-3] O.s.web.servlet.dispatcherservlet:frameworkservlet ' SPRINGMVC ': initialization started2016-06-16 12:52:30.086 INFO 10150---[http-nio-8082-exec-3]. s.annotationconfigwebapplicationcontext:refreshing Webapplicationcontext for namespace ' Springmvc-servlet ': startup Date [Thu June 12:52:30 GMT 2016]; parent:org.springframework.boot[email protected]1ed431e92016-06-16 12:52:30.145 INFO 10150---[ Http-nio-8082-exec-3] o.s.web.servlet.dispatcherservlet:frameworkservlet ' SPRINGMVC ': initialization completed in ms2016-06-16 12:52:30.176 INFO 10150---[http-nio-8082-exec-3] c.z.d.i.web.interceptor.loginterceptor: request log, ip=12 7.0.0.1,uri=/error,params={}2016-06-16 12:52:30.230 Error 10150---[http-nio-8082-exec-3] o.a.c.c.C.[Tomcat]. [localhost]: Exception processing errorpage[errorcode=0, Location=/error]org.apache.catalina.connector.clientab OrtException:java.io.IOException:Broken pipe at Org.apache.catalina.connector.OutputBuffer.realWriteBytes (OUTPUTB uffer.java:393) at Org.apache.tomcat.util.buf.ByteChunk.flushBuffer (bytechunk.java:426) at Org.apache.catalina.connector.OutputBuffer.doFlush (outputbuffer.java:342) at Org.apache.catalina.conne ctor. Outputbuffer.flush (outputbuffer.java:317) at Org.apache.catalina.connector.CoyoteOutputStream.flush ( coyoteoutputstream.java:110) at Com.fasterxml.jackson.core.json.UTF8JsonGenerator.flush (Utf8jsongenerator.java : 1044) at Com.fasterxml.jackson.databind.ObjectWriter.writeValue (objectwriter.java:854) at Org.springframewo Rk.http.converter.json.AbstractJackson2HttpMessageConverter.writeInternal ( abstractjackson2httpmessageconverter.java:265) at Org.springframework.http.converter.AbstractGenericHttpMessageConverter.write ( ABSTRACTGENERICHTTPMESSAGECONVERTER.JAVA:100) at Org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters (abstractmessageconvertermethodprocessor.java:222) at Org.springframework.web.servlet.mvc.method.annotation.HttpEntityMethodProcessor.haNdlereturnvalue (httpentitymethodprocessor.java:183) at Org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.handleReturnValue ( HANDLERMETHODRETURNVALUEHANDLERCOMPOSITE.JAVA:80) at Org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle ( servletinvocablehandlermethod.java:126) at Org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod ( requestmappinghandleradapter.java:817) at Org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal ( requestmappinghandleradapter.java:731) at Org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle ( abstracthandlermethodadapter.java:85) at Org.springframework.web.servlet.DispatcherServlet.doDispatch ( dispatcherservlet.java:959) at Org.springframework.web.servlet.DispatcherServlet.doService ( dispatcherservlet.java:893) at ORG.SPRIngframework.web.servlet.FrameworkServlet.processRequest (frameworkservlet.java:968) at Org.springframework.web.servlet.FrameworkServlet.doPost (frameworkservlet.java:870) at Javax.servlet.http.HttpServlet.service (httpservlet.java:648) at Org.springframework.web.servlet.FrameworkServlet.service (frameworkservlet.java:844) at Javax.servlet.http.HttpServlet.service (httpservlet.java:729) at Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (applicationfilterchain.java:292) at Org.apache.catalina.core.ApplicationFilterChain.doFilter (applicationfilterchain.java:207) at Org.apache.catalina.core.ApplicationDispatcher.invoke (applicationdispatcher.java:720) at Org.apache.catalina.core.ApplicationDispatcher.processRequest (applicationdispatcher.java:468) at Org.apache.catalina.core.ApplicationDispatcher.doForward (applicationdispatcher.java:391) at Org.apache.catalina.core.ApplicationDispatcher.forward (Applicationdispatcher.java:318) at Org.apache.catalina.core.StandardHostValve.custom (standardhostvalve.java:445) at Org.apa Che.catalina.core.StandardHostValve.status (standardhostvalve.java:304) at Org.apache.catalina.core.StandardHostValve.throwable (standardhostvalve.java:399) at Org.apache.catalina.core.AsyncContextImpl.setErrorState (asynccontextimpl.java:460) at Org.apache.catalina.connector.CoyoteAdapter.asyncDispatch (coyoteadapter.java:293) at Org.apache.coyote.http11.AbstractHttp11Processor.asyncDispatch (abstracthttp11processor.java:1715) at Org.apache.coyote.abstractprotocol$abstractconnectionhandler.process (abstractprotocol.java:652) at Org.apache.tomcat.util.net.nioendpoint$socketprocessor.dorun (nioendpoint.java:1500) at Org.apache.tomcat.util.net.nioendpoint$socketprocessor.run (nioendpoint.java:1456) at Java.util.concurrent.ThreadPoolExecutor.runWorker (threadpoolexecutor.java:1142) at Java.util.concurrent.ThreadPoolExecutor$worker.run (threadpoolexecutor.java:617) at org.apache.tomcat.util.threads.taskthread$ Wrappingrunnable.run (taskthread.java:61) at Java.lang.Thread.run (thread.java:745) caused by:java.io.IOException:Br Oken pipe at Sun.nio.ch.FileDispatcherImpl.write0 (Native Method) at Sun.nio.ch.SocketDispatcher.write (Socket dispatcher.java:47) at Sun.nio.ch.IOUtil.writeFromNativeBuffer (ioutil.java:93) at Sun.nio.ch.IOUtil.write (IO UTIL.JAVA:65) at Sun.nio.ch.SocketChannelImpl.write (socketchannelimpl.java:471) at Org.apache.tomcat.util.ne T.niochannel.write (niochannel.java:124) at Org.apache.tomcat.util.net.NioBlockingSelector.write ( nioblockingselector.java:101) at Org.apache.tomcat.util.net.NioSelectorPool.write (nioselectorpool.java:172) At Org.apache.coyote.http11.InternalNioOutputBuffer.writeToSocket (internalniooutputbuffer.java:139) at Org.apache . Coyote.http11.InternalNioOutputBuffer.addToBB (INTERNALNIOOUTPUTBUffer.java:197) at org.apache.coyote.http11.internalniooutputbuffer.access$000 (internalniooutputbuffer.java:41) At Org.apache.coyote.http11.internalniooutputbuffer$socketoutputbuffer.dowrite (InternalNioOutputBuffer.java:320 ) at Org.apache.coyote.http11.filters.ChunkedOutputFilter.doWrite (chunkedoutputfilter.java:116) at Org.apach E.coyote.http11.abstractoutputbuffer.dowrite (abstractoutputbuffer.java:256) at Org.apache.coyote.Response.doWrite (response.java:501) at Org.apache.catalina.connector.OutputBuffer.realWriteBytes (outputbuffer.java:388) ... Common frames omitted2016-06-16 12:52:30.240 INFO 10150---[http-nio-8082-exec-3] C.z.d.i.web.interceptor.loginterceptor: Request log, ip=127.0.0.1,uri=/port,params={}2016-06-16 12:52:30.244 ERROR 10150-- -[http-nio-8082-exec-3] o.a.c.c.c.[tomcat]. [localhost]: Exception processing errorpage[errorcode=0, Location=/error]
This error occurs about 3 minutes after Tomcat starts running. on the surface of this error, a null error occurred during the run of the Tomcat container. I found some of the relevant solutions to this error on the Internet, some people say that the project is too many logs to cause this error, after clearing the relevant logs, the error still occurs.
Is there a problem with my project that caused the Tomcat container to stop? So I found in the log the day that the error occurred, began to test, found a strange phenomenon, the local project runs around 10min in the hprose of the server has a null error, but then the error will be skipped, the equivalent of restarting Tomcat, continue to move forward, such as:
At the same time, the Hprose client stops with the following error:
is it my project to deal with the non-standard, some value is empty? So it causes the Hprose client to stop, but why is Tomcat re-connected and can it be linked successfully?
These are the problems, I will be in the project's methods are used in the try catch package, and then find out the log before the error, according to this log to set the breakpoint, but unfortunately, this error does not appear at this time, but in the run about 10 minutes or so when the time again to appear, And there is no log record that I catche to.
This exclusion is a matter of program code. I told the boss, boss guess I use the Hprose client is Java, he used the Hprose client is PHP, is not the client's problem. Although the eldest brother said so, but I think the Java hprose client and PHP hprose client, in addition to the language is not the same, the call method is not the same, the other is no different ah?
So I thought about avoiding hprose calls and changing the rest calls. After I changed the project to rest style, the project ran for a period of time to report the error,
Don't forget that the rest-style project uses HTTP requests when it is called.
Speaking of which, I understand how this error is probably produced, the cause of this error, but also from Hprose. Hprose is an RPC framework style framework, in fact, no matter what the RPC framework style or DI frame style or rest style, involving this client service side, in fact, will eventually boil down to network transmission. So this is a network transmission problem, the service side has not gone through its own service, the client has stopped, so there is this error. Hprose has a property that extends the service-side time, as long as the property is modified, just fine.
So modify the Hprose property as follows:
Test again, problem solved.
Summarize:
Through this problem, let me and further realize Hprose, understand that no matter what frame style, what the Di, Rest, Rpc, ultimately, the so-called remote call all need to go to the network transmission. Know it and know why.
Error number Org.apache.catalina.connector.ClientAbortException:java.io.IOException:Broken pipe