You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Geoff Soutter <ge...@whitewolf.com.au> on 1999/12/10 09:07:36 UTC
PATCH: ignore "bogus" connection reset by peer exceptions
Hi again,
Well I'm not sure how this affects others, but on my system (WinNT), I
continually get "Connection reset by peer" messages from the HttpAdaptor
connector. This very bodgy hack at least shuts it up, and doesn't seem to
have any bad effects... so if no-one objects, can we add this patch please?
Cheers
Geoff
Index:
jakarta-tomcat/src/share/org/apache/tomcat/service/http/HttpRequestAdapter.j
ava
===================================================================
RCS file:
/home/cvspublic/jakarta-tomcat/src/share/org/apache/tomcat/service/http/Http
RequestAdapter.java,v
retrieving revision 1.1
diff -c -r1.1 HttpRequestAdapter.java
*** HttpRequestAdapter.java 1999/11/01 22:24:19 1.1
--- HttpRequestAdapter.java 1999/12/10 08:00:49
***************
*** 109,117 ****
// cut&paste from BufferedInputStream.
// XXX reuse buff, avoid creating strings
byte[] buf = new byte[1024];
! int count = in.readLine(buf, 0, buf.length);
! if (count >= 0) {
! line=new String(buf, 0, count);
}
processRequestLine(response,line);
--- 109,129 ----
// cut&paste from BufferedInputStream.
// XXX reuse buff, avoid creating strings
byte[] buf = new byte[1024];
! try
! {
! // read the line for next request here - may validly fail?
! int count = in.readLine(buf, 0, buf.length);
! if (count >= 0) {
! line=new String(buf, 0, count);
! }
! }
! catch (SocketException e)
! {
! // try and hide this exception, it's bogus
! if (e.getMessage().indexOf( "Connection reset by peer" ) != -1)
! response.setStatus( HttpServletResponse.SC_BAD_REQUEST );
! else
! throw e;
}
processRequestLine(response,line);
Re: PATCH: ignore "bogus" connection reset by peer exceptions
Posted by Co...@eng.sun.com.
Geoff Soutter wrote:
> Hi again,
>
> Well I'm not sure how this affects others, but on my system (WinNT), I
> continually get "Connection reset by peer" messages from the HttpAdaptor
> connector. This very bodgy hack at least shuts it up, and doesn't seem to
> have any bad effects... so if no-one objects, can we add this patch please?
>
Sorry for the delay, last 2 weeks I was out of my office, using slow
connections.
I can check in the patch, but I feel it's better to try to find the real
problem.
We had a similar problem on Linux ( the POST failing on Linux), and
it seems that "connection reset by peer" can hide something deeper, and
hiding it can be bad. ( there is no reason for the browser to sent a RST -
it that happens probably there is something really wrong going on)
I'll try to reproduce the problem when I'll return from holliday ( and if I
find
a NT !).
Costin