• 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
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

java.net.SocketException: Connection reset while reading a large file

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We have built java based REST Webservices for the mobile app to interact with Sharepoint server. We are hosting webservices on weblogic server. Textual data is transferred in JSON format and file assets are transferred to iPad application as a binary stream. We are using HTTP GET to retrieve the file asset from the sharepoint. We have been noticing issues while trying to retrieve file assets which are greater than 20MB and only in production environment.

For files greater than 20MB, we have been noticing java.net.SocketException:Connection reset or java.net.SocketException: Socket closed depending on when the socket is closed.

We are using Apache HTTPClient 4.2 as http client and apache commons IO library for IO copy.

Below is the code -


This is only happening in production and uat environments where we cannot have wireshark installed to debug this further. Have validated the sharepoint setting and weblogic settings and they are same as other environments.

Below is the stack trace of the error -

Thanks!
 
Ranch Hand
Posts: 172
Redhat Ruby C++
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The connection reset comes from the client side (not the server you are getting the date), which means a stale object/connection. I saw that the CloseShieldInputStream ( http://grepcode.com/file/repo1.maven.org/maven2/commons-io/commons-io/2.0.1/org/apache/commons/io/input/CloseShieldInputStream.java ) doesn't close the connection, so you need to close the contentStream in the finally block.

Best regards,
Luan
 
I have gone to look for myself. If I should return before I get back, keep me here with this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic