Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

SocketException

 
Archana Annamaneni
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In on my web application I am getting the following Exception .

On our production system it happens once in a while and causing the system go down.What could be the problem , please advice.
I do access the files in the program , and actually i use transformer object to transform a XML file by applying an XSLT.

java.net.SocketException: Too many open files
at java.net.Socket.createImpl(Socket.java:331)
at java.net.Socket.connect(Socket.java:450)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.<init>(DashoA6275)
at com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl.createSocket(DashoA6275)
at sun.net.www.protocol.https.HttpsClient.doConnect(DashoA6275)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:402)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:618)
at sun.net.www.protocol.https.HttpsClient.<init>(DashoA6275)
at sun.net.www.protocol.https.HttpsClient.a(DashoA6275)
at sun.net.www.protocol.https.HttpsClient.a(DashoA6275)
at sun.net.www.protocol.https.HttpsClient.a(DashoA6275)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.plainConnect(Dash oA6275)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(DashoA627 5)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.j ava:560)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(DashoA6275)
at com.nbd.xmlgateway.AimAction.getAimData(AimAction.java:209)
at com.nbd.xmlgateway.AimAction.execute(AimAction.java:96)
 
David Harkness
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On many operating systems (at least Unix and Unix-like systems, maybe Windows too) sockets are implemented similarly to files using OS file descriptors. If you run out of FDs opening files, you still cannot open sockets (at least I think they're pooled together like that).

In any case, make sure you're closing sockets and file streams when you're done with them, preferably in finally blocks so exceptions don't cause leaks.

You could also look for a tool that will show you how many FDs are in use so you can track the problem down.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!