Re: ClientAbortException: java.net.SocketException: Connection reset by peer: socket write error

2005-06-28 Thread Tim Funk
Connection reset by peer means the client disconnected before all the data 
was sent.


-Tim


Adriana Suarez wrote:

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(OutputBuffer.java:373)


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: ClientAbortException: java.net.SocketException: Connection reset by peer: socket write error

2005-06-28 Thread Ronald Klop

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 
 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:[EMAIL PROTECTED]
> 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);
> by

RE: ClientAbortException: java.net.SocketException: Connection reset by peer: socket write error

2005-06-28 Thread Allistair Crossley
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:[EMAIL PROTECTED]
> 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 BufferedOu