You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Stephen Charles Huey <st...@fastmail.fm> on 2005/02/02 00:29:51 UTC

SocketException: Too many open files

I'm running some simple but fast-pounding test programs against our
Tomcat server from a machine on the same network, and we've been tuning
our database, etc, based on this.  But right now, I'm seeing a new one
coming out of our Java code whenever we try to open a URL:


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(DashoA12275)
	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.<init>(DashoA12275)
	at com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl.createSocket(DashoA12275)
	at sun.net.www.protocol.https.HttpsClient.doConnect(DashoA12275)
	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>(DashoA12275)
	at sun.net.www.protocol.https.HttpsClient.a(DashoA12275)
	at sun.net.www.protocol.https.HttpsClient.a(DashoA12275)
	at sun.net.www.protocol.https.HttpsClient.a(DashoA12275)
	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.plainConnect(DashoA12275)
	at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(DashoA12275)
	at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(DashoA12275)



We're opening lots of these, and it appears we're opening more than a
maximum number of connections to the internet.  Is there a way to bump
this up?  Or maybe we're just pounding this harder than it will ever get
hit in the real world?  I'm also seeing this as well:





SEVERE: Endpoint ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=80]
ignored exception: java.net.SocketException: Too many open files
java.net.SocketException: Too many open files
	at java.net.PlainSocketImpl.socketAccept(Native Method)
	at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:353)
	at java.net.ServerSocket.implAccept(ServerSocket.java:448)
	at java.net.ServerSocket.accept(ServerSocket.java:419)
	at org.apache.tomcat.util.net.DefaultServerSocketFactory.acceptSocket(DefaultServerSocketFactory.java:107)
	at org.apache.tomcat.util.net.PoolTcpEndpoint.acceptSocket(PoolTcpEndpoint.java:356)
	at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:529)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
	at java.lang.Thread.run(Thread.java:534)
Feb 1, 2005 4:53:08 PM org.apache.tomcat.util.net.PoolTcpEndpoint
closeServerSocket
SEVERE: Caught exception trying to unlock accept.
java.net.SocketException: Too many open files
	at java.net.Socket.createImpl(Socket.java:331)
	at java.net.Socket.<init>(Socket.java:304)
	at java.net.Socket.<init>(Socket.java:124)
	at org.apache.tomcat.util.net.PoolTcpEndpoint.closeServerSocket(PoolTcpEndpoint.java:326)
	at org.apache.tomcat.util.net.PoolTcpEndpoint.acceptSocket(PoolTcpEndpoint.java:397)
	at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:529)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
	at java.lang.Thread.run(Thread.java:534)
Feb 1, 2005 4:53:08 PM org.apache.tomcat.util.net.PoolTcpEndpoint
acceptSocket
WARNING: Reinitializing ServerSocket


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: SocketException: Too many open files

Posted by Stephen Charles Huey <st...@fastmail.fm>.
Do other Tomcat users often need to raise this limit on Linux?  In
addition to talking to website users, our Tomcat also has to talk to
another web server elsewhere on the internet to verify a lot of stuff...


----- Original message -----
From: "Remy Maucherat" <re...@gmail.com>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Date: Wed, 2 Feb 2005 00:52:56 +0100
Subject: Re: SocketException: Too many open files

On Tue, 01 Feb 2005 17:29:51 -0600, Stephen Charles Huey
<st...@fastmail.fm> wrote:
> I'm running some simple but fast-pounding test programs against our
> Tomcat server from a machine on the same network, and we've been tuning
> our database, etc, based on this.  But right now, I'm seeing a new one
> coming out of our Java code whenever we try to open a URL:
> 
> java.net.SocketException: Too many open files

If you're on Linux, use ulimit -a to see what the limits are, and
ulimit -n to change the value. However, only root is allowed to get
more than 1024 files (does somebody knows why ?).


-- 
xxxxxxxxxxxxxxxxxxxxxxxxx
R&#233;my Maucherat
Developer & Consultant
JBoss Group (Europe) S&#224;RL
xxxxxxxxxxxxxxxxxxxxxxxxx

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: SocketException: Too many open files

Posted by Remy Maucherat <re...@gmail.com>.
On Tue, 01 Feb 2005 17:29:51 -0600, Stephen Charles Huey
<st...@fastmail.fm> wrote:
> I'm running some simple but fast-pounding test programs against our
> Tomcat server from a machine on the same network, and we've been tuning
> our database, etc, based on this.  But right now, I'm seeing a new one
> coming out of our Java code whenever we try to open a URL:
> 
> java.net.SocketException: Too many open files

If you're on Linux, use ulimit -a to see what the limits are, and
ulimit -n to change the value. However, only root is allowed to get
more than 1024 files (does somebody knows why ?).


-- 
xxxxxxxxxxxxxxxxxxxxxxxxx
Rémy Maucherat
Developer & Consultant
JBoss Group (Europe) SàRL
xxxxxxxxxxxxxxxxxxxxxxxxx

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: SocketException: Too many open files

Posted by QM <qm...@brandxdev.net>.
On Tue, Feb 01, 2005 at 05:29:51PM -0600, Stephen Charles Huey wrote:
: java.net.SocketException: Too many open files
:  [snip]
: We're opening lots of these, and it appears we're opening more than a
: maximum number of connections to the internet.  Is there a way to bump
: this up?  Or maybe we're just pounding this harder than it will ever get
: hit in the real world?

I don't recall which OS you run, but look into tuning the TCP stack for
the short, bursty connection style of HTTP.  There's a setting that
determines how long your server hangs onto a socket after the connection
has closed. 

For the life of me, I can't remember this parm right now, but I've seen
it here and there.  

Search the archives for "Too many open files" and my e-mail address.
You should turn up a post in which I've answered this question before.

-QM


-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org