• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

java.net.SocketException: Software caused connection abort: socket write error

 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Friends,

We use the following code in our servlet to send back an XML file to the client.

ItemDownloadDoc.java class:


// This method initializes the writer out and zipOutputStream instance variables declared above. The OutputStream passed to this method is response.getOutputStream()

// This method we use in our servlet to write an ItemBean object to the XML file which is being sent to the OutputStream. The xmlWriter is just a utility class which takes the ItemBean object and Writer object and then transforms the
// ItemBean object to XML and write to OutputStream using the "out" Writer object passed to it. The Writer(or OutputStream) is not closed in any of xmlWriter's methods.



// This method is to flush and close the OutputStreams.

Now the above class works well for downloads of 15 MB in size but when it exceeds that then the following error is thrown:
INFO | jvm 1 | 2010/02/03 08:32:29 | java.net.SocketException: Software caused connection abort: socket write error
INFO | jvm 1 | 2010/02/03 08:32:29 | at java.net.SocketOutputStream.socketWrite0(Native Method)
INFO | jvm 1 | 2010/02/03 08:32:29 | at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
INFO | jvm 1 | 2010/02/03 08:32:29 | at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
INFO | jvm 1 | 2010/02/03 08:32:29 | at org.apache.coyote.http11.InternalOutputBuffer.realWriteBytes(InternalOutputBuffer.java:737)
INFO | jvm 1 | 2010/02/03 08:32:29 | at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:434)
INFO | jvm 1 | 2010/02/03 08:32:29 | at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:349)
INFO | jvm 1 | 2010/02/03 08:32:29 | at org.apache.coyote.http11.InternalOutputBuffer$OutputStreamOutputBuffer.doWrite(InternalOutputBuffer.java:761)
INFO | jvm 1 | 2010/02/03 08:32:29 | at org.apache.coyote.http11.filters.ChunkedOutputFilter.doWrite(ChunkedOutputFilter.java:126)
INFO | jvm 1 | 2010/02/03 08:32:29 | at org.apache.coyote.http11.InternalOutputBuffer.doWrite(InternalOutputBuffer.java:570)
INFO | jvm 1 | 2010/02/03 08:32:29 | at org.apache.coyote.Response.doWrite(Response.java:560)
INFO | jvm 1 | 2010/02/03 08:32:29 | at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:353)
INFO | jvm 1 | 2010/02/03 08:32:29 | at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:434)
INFO | jvm 1 | 2010/02/03 08:32:29 | at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:349)
INFO | jvm 1 | 2010/02/03 08:32:29 | at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:381)
INFO | jvm 1 | 2010/02/03 08:32:29 | at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:370)
INFO | jvm 1 | 2010/02/03 08:32:29 | at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:89)
INFO | jvm 1 | 2010/02/03 08:32:29 | at java.util.zip.DeflaterOutputStream.deflate(DeflaterOutputStream.java:156)
INFO | jvm 1 | 2010/02/03 08:32:29 | at java.util.zip.DeflaterOutputStream.write(DeflaterOutputStream.java:114)
INFO | jvm 1 | 2010/02/03 08:32:29 | at java.util.zip.ZipOutputStream.write(ZipOutputStream.java:259)
INFO | jvm 1 | 2010/02/03 08:32:29 | at sun.nio.cs.StreamEncoder$CharsetSE.writeBytes(StreamEncoder.java:336)
INFO | jvm 1 | 2010/02/03 08:32:29 | at sun.nio.cs.StreamEncoder$CharsetSE.implWrite(StreamEncoder.java:395)
INFO | jvm 1 | 2010/02/03 08:32:29 | at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:136)
INFO | jvm 1 | 2010/02/03 08:32:29 | at java.io.OutputStreamWriter.write(OutputStreamWriter.java:191)
INFO | jvm 1 | 2010/02/03 08:32:29 | at java.io.BufferedWriter.flushBuffer(BufferedWriter.java:111)
INFO | jvm 1 | 2010/02/03 08:32:29 | at java.io.BufferedWriter.write(BufferedWriter.java:212)
INFO | jvm 1 | 2010/02/03 08:32:29 | at java.io.Writer.write(Writer.java:126)
INFO | jvm 1 | 2010/02/03 08:32:29 | at com.nit.tim.shared.xml.output.XmlOutput.output(XmlOutput.java:111)
INFO | jvm 1 | 2010/02/03 08:32:29 | at com.nit.tim.shared.io.ItemDownloadDoc.add(ItemDownloadDoc.java:150)
INFO | jvm 1 | 2010/02/03 08:32:29 | at com.nit.tim.webclient.action.DownloadResultsAction.execute(DownloadResultsAction.java:126)


Now the question is why does it happen for bigger downloads and not for smaller downloads? And What should be done to avoid this error?
Any inputs will be highly appreciated !
Best Regards,
Nitin
 
Sheriff
Posts: 22650
126
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please UseCodeTags. You can edit your post to add them.
 
For my next feat, I will require a volunteer from the audience! Perhaps this tiny ad?
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic