It's not a secret anymore!*
The moose likes Servlets and the fly likes SocketException when accessing servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "SocketException when accessing servlet" Watch "SocketException when accessing servlet" New topic
Author

SocketException when accessing servlet

Charles Talbott
Greenhorn

Joined: Feb 09, 2001
Posts: 12
I am trying make multiple requests to a servlet from an app which creates a number of threads. The threads make multiple requests to the servlet. When I use a low number of threads, everything 'appears' to work fine. When the thread count increases, I start getting 'SocketException: Too many files open' errors and then the Weblogic server crashes. Does anyone know what might cause this type of error and what exactly this type of error is? Any help would be greatly appreciated.


Charles Talbott<BR>Sun Certified Java 2 Programmer
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040

You might have already done this, but thought of suggesting
then the Weblogic server crashes
I would capture the exception and search the Weblogic
docs for the exception or for a string like "too many
threads".
I know this seems trivial and obvious, but then thought
I will start some conversation here.......
regds.
- satya

Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
Charles Talbott
Greenhorn

Joined: Feb 09, 2001
Posts: 12
The initial problem with the server turned out to be an unrelated issue and is now operating fine.
I discovered that the requests to the servlet are being handled fine. The servlet is sending requests fine. I am pretty sure the problem is in my app. The exception occurs when I try to capture the responses in my app via connection.geInputStream() (where connection is an HttpURLConnection object internal to the run() method). I don't think I am leaving files open. Again, any help is much appreciated.
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040

do you suspect any timeout issues?
sorry i keep guessing, but I am also trying to gain some
knowledge abt these probls.
regds.
- satya
Charles Talbott
Greenhorn

Joined: Feb 09, 2001
Posts: 12
I've discovered that the issue is system related. In Unix, an application process is allowed a finite number of file handles.
ulimit -n will display this number.
The default is 256 the max I believe is 1024. As the number of threads/requests was increasing, I began to exceed this number, hence the 'too many open files' errors. I suspect there is also a limit for the jre, and I am trying to track this down.
 
Consider Paul's rocket mass heater.
 
subject: SocketException when accessing servlet
 
Similar Threads
Multiple instances and multiple threads
Servlet Multiple instances?
When is a Servlet destroyed?
multithreading in servlet
Is a Servlet thread-safe