24

I am getting the following error frequently while retrieving file object from database column. How can I resolve this problem?

May 8, 2009 3:18:14 PM org.apache.catalina.core.StandardHostValve status
  WARNING: Exception Processing ErrorPage[errorCode=404, location=/error.jsp]
  ClientAbortException:  java.net.SocketException: Connection reset by peer: socket write error
  at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:327)
  at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:293)
  at org.apache.catalina.connector.Response.flushBuffer(Response.java:537)
  at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:286)
  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:136)
  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
  at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
  at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
  at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)        
  at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
  at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
  at java.lang.Thread.run(Unknown Source)

Caused by: java.net.SocketException: Connection reset by peer: socket write error
  at java.net.SocketOutputStream.socketWrite0(Native Method)
  at java.net.SocketOutputStream.socketWrite(Unknown Source)
  at java.net.SocketOutputStream.write(Unknown Source)
  at org.apache.coyote.http11.InternalOutputBuffer.realWriteBytes(InternalOutputBuffer.java:746)
  at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:433)
  at org.apache.coyote.http11.InternalOutputBuffer.flush(InternalOutputBuffer.java:304)
  at org.apache.coyote.http11.Http11Processor.action(Http11Processor.java:991)
  at org.apache.coyote.Response.action(Response.java:182)
  at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:322)
  ... 13 more
ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
  • 1
    Do you actually see an actual problem, or do you just get these messages in your logging? – Arnout Engelen Aug 06 '12 at 12:12
  • This question is about an exception for a servlet. For a similar question for a client see http://stackoverflow.com/questions/34673336/httpclient-connection-reset-by-peer-socket-write-error – Raedwald Jan 09 '16 at 14:06

4 Answers4

40

Your HTTP client disconnected.

This could have a couple of reasons:

  • Responding to the request took too long, the client gave up
  • You responded with something the client did not understand
  • The end-user actually cancelled the request
  • A network error occurred
  • ... probably more

You can fairly easily emulate the behavior:

URL url = new URL("http://example.com/path/to/the/file");

int numberOfBytesToRead = 200;

byte[] buffer = new byte[numberOfBytesToRead];
int numberOfBytesRead = url.openStream().read(buffer);
bluish
  • 26,356
  • 27
  • 122
  • 180
alamar
  • 18,729
  • 4
  • 64
  • 97
  • 15
    IMO, the most likely item from your list is "The end-user actually cancelled the request". Bloody users, always causing trouble :-P – ashirley Jul 26 '13 at 11:15
10

Your log indicates ClientAbortException, which occurs when your HTTP client drops the connection with the server and this happened before server could close the server socket Connection.

Badal
  • 4,078
  • 4
  • 28
  • 28
2

I have got this error on open page from Google Cache.

I think, cached page(client) disconnecting on page loading.

You can ignore this error log with try-catch on filter.

kfatih
  • 119
  • 1
  • 5
-2

Windows Firewall could cause this exception, try to disable it or add a rule for port or even program (java)

Yura
  • 1,733
  • 1
  • 20
  • 19
  • Windows Firewall would have prevented the connection completely if that was the problem. – user207421 May 12 '15 at 22:59
  • "prevent" in a what way? It's an obvious that you will get exception (to my mind java.net.SocketException) when your program will try to open connection, the question is here what the message you will see... In fact I fixed the one with "Connection reset by peer: socket write error" by introducing new rule in a windows firewall. – Yura May 13 '15 at 10:12
  • 1
    @Yura "Prevent" as in not let the server accept the client's connection in the first place. – ThePyroEagle Jun 12 '15 at 15:02
  • A firewall might sever the connection as a result of disliking the deep packet inspection results. – buzz3791 May 24 '21 at 19:19