tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ronald Klop <ronald-mailingl...@base.nl>
Subject RE: ClientAbortException: java.net.SocketException: Connection reset by peer: socket write error
Date Tue, 28 Jun 2005 08:55:46 GMT
This exception means the client (browser) has closed the connection before Tomcat send all
its data. If the application works you should ignore this. My log is full of it. It also happens
if you download something large from Tomcat and click cancel during the download.

Ronald.

On Tue Jun 28 10:04:14 CEST 2005 Tomcat Users List <tomcat-user@jakarta.apache.org>
wrote:
> Which line of code is on 71?
> 
> helloworldservlet.ServletVideo.streamBinaryData(ServletVideo.java:71)
> 
> In your finally block, you are closing the servlet output stream, I wonder if that's
causing tomcat a problem since it usually closes the servlet output stream itself? 
> 
> Humour me and change
> 
> if( outstr != null ) {
> outstr.flush();
> outstr.close();
> }
> 
> to 
> 
> if( outstr != null ) {
> outstr.flush();
> }
> 
> 
> > -----Original Message-----
> > From: Adriana Suarez [mailto:adriana.suarez@gmail.com]
> > Sent: 28 June 2005 04:33
> > To: tomcat-user@jakarta.apache.org
> > Subject: ClientAbortException: java.net.SocketException: Connection
> > reset by peer: socket write error
> > 
> > 
> > Hello,
> > 
> > I got this exception and I don't know how to solve it, I have a web
> > application with a servlet which sends video with formats avi, mpeg,
> > and mov, it shows the video but the tomcat throws this exception:
> > 
> > ClientAbortException: java.net.SocketException: Connection reset by
> > peer: socket write error
> > at 
> > org.apache.coyote.tomcat5.OutputBuffer.realWriteBytes(OutputBu
> > ffer.java:373)
> > at 
> > org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:323)
> > at 
> > org.apache.coyote.tomcat5.OutputBuffer.writeBytes(OutputBuffer
> > .java:401)
> > at 
> > org.apache.coyote.tomcat5.OutputBuffer.write(OutputBuffer.java:388)
> > at 
> > org.apache.coyote.tomcat5.CoyoteOutputStream.write(CoyoteOutpu
> > tStream.java:76)
> > at 
> > java.io.BufferedOutputStream.write(BufferedOutputStream.java:106)
> > at 
> > helloworldservlet.ServletVideo.streamBinaryData(ServletVideo.java:71)
> > at helloworldservlet.ServletVideo.doGet(ServletVideo.java:37)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> > at 
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilt
> > er(ApplicationFilterChain.java:237)
> > at 
> > org.apache.catalina.core.ApplicationFilterChain.doFilter(Appli
> > cationFilterChain.java:157)
> > at 
> > org.apache.catalina.core.StandardWrapperValve.invoke(StandardW
> > rapperValve.java:214)
> > at 
> > org.apache.catalina.core.StandardValveContext.invokeNext(Stand
> > ardValveContext.java:104)
> > at 
> > org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
> > ine.java:520)
> > at 
> > org.apache.catalina.core.StandardContextValve.invokeInternal(S
> > tandardContextValve.java:198)
> > at 
> > org.apache.catalina.core.StandardContextValve.invoke(StandardC
> > ontextValve.java:152)
> > at 
> > org.apache.catalina.core.StandardValveContext.invokeNext(Stand
> > ardValveContext.java:104)
> > at 
> > org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
> > ine.java:520)
> > at 
> > org.apache.catalina.core.StandardHostValve.invoke(StandardHost
> > Valve.java:137)
> > at 
> > org.apache.catalina.core.StandardValveContext.invokeNext(Stand
> > ardValveContext.java:104)
> > at 
> > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReport
> > Valve.java:117)
> > at 
> > org.apache.catalina.core.StandardValveContext.invokeNext(Stand
> > ardValveContext.java:102)
> > at 
> > org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
> > ine.java:520)
> > at 
> > org.apache.catalina.core.StandardEngineValve.invoke(StandardEn
> > gineValve.java:109)
> > at 
> > org.apache.catalina.core.StandardValveContext.invokeNext(Stand
> > ardValveContext.java:104)
> > at 
> > org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
> > ine.java:520)
> > at 
> > org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
> > at 
> > org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.
> > java:160)
> > at 
> > org.apache.coyote.http11.Http11Processor.process(Http11Process
> > or.java:799)
> > at 
> > org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandle
> > r.processConnection(Http11Protocol.java:705)
> > at 
> > org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoi
> > nt.java:577)
> > at 
> > org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
> > ThreadPool.java:683)
> > at java.lang.Thread.run(Thread.java:534)
> > 
> > and this is where the code fails:
> > 
> > private void streamBinaryData(String urlstr,String
> > format,ServletOutputStream outstr, HttpServletResponse resp)
> > {
> > String ErrorStr = null;
> > try{
> > //find the right mime type and set it as contenttype
> > resp.setContentType(getMimeType(format));
> > BufferedInputStream bis = null;
> > BufferedOutputStream bos = null;
> > try{
> > URL url = new URL(urlstr);
> > URLConnection urlc= url.openConnection();
> > int length =urlc.getContentLength();
> > resp.setContentLength(length);
> > // Use Buffered Stream for reading/writing.
> > InputStream in = urlc.getInputStream();
> > bis = new BufferedInputStream(in);
> > bos = new BufferedOutputStream(outstr);
> > byte[] buff = new byte[length];
> > int bytesRead;
> > // Simple read/write loop.
> > while(-1 != (bytesRead = bis.read(buff, 0, 
> > buff.length))) {
> > bos.write(buff, 0, bytesRead);
> > }
> > } catch (Exception e) {
> > e.printStackTrace();
> > ErrorStr = "Error Streaming the Data";
> > outstr.print(ErrorStr);
> > } finally {
> > if( bis != null ) {
> > bis.close();
> > }
> > if( bos != null ) {
> > bos.close();
> > }
> > if( outstr != null ) {
> > outstr.flush();
> > outstr.close();
> > }
> > }
> > }
> > catch(Exception e){
> > e.printStackTrace();
> > }
> > }
> > 
> > I have read many forums but they do not explain in detail what the
> > problem is, some they say is a tomcat bug. Can anyone help me to
> > figure it out?
> > 
> > Thanks
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> > 
> > 
> 
> 
> <FONT SIZE=1 FACE="VERDANA,ARIAL" COLOR=BLUE> 
> -------------------------------------------------------
> QAS Ltd.
> Registered in England: No 2582055
> Registered in Australia: No 082 851 474
> -------------------------------------------------------
> </FONT>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message