You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Matteo Tamburini <mt...@fastwebnet.it> on 2003/10/31 19:55:33 UTC

Too many CLOSE_WAIT socket connections

Hi. 
I've got a thread (axis client) which calls an axis web service several
times (some thousands).
My client code creates the Service object, than creates the Call object
(exactly as shown in the Axis User's Guide). 
Finally the invoke method from the Call class is called.
Everything just works fine for the first thousand times, but then I get an
exception: 
AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode: 
 faultString: java.net.SocketException: Too many open files
 faultActor: 
 faultNode: 
 faultDetail: 
	{http://xml.apache.org/axis/}stackTrace: java.net.SocketException:
Too many open files
	at java.net.Socket.createImpl(Socket.java:313)
	at java.net.Socket.&lt;init&gt;(Socket.java:286)
	at java.net.Socket.&lt;init&gt;(Socket.java:119)
	at
org.apache.axis.components.net.DefaultSocketFactory.create(DefaultSocketFact
ory.java:129)
	at
org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:157)
	at
org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:114)
	at
org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:
71)
	at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:150)
	at org.apache.axis.SimpleChain.invoke(SimpleChain.java:120)
	at org.apache.axis.client.AxisClient.invoke(AxisClient.java:180)
	at org.apache.axis.client.Call.invokeEngine(Call.java:2564)
	at org.apache.axis.client.Call.invoke(Call.java:2553)
	at org.apache.axis.client.Call.invoke(Call.java:2248)
	at org.apache.axis.client.Call.invoke(Call.java:2171)
	at org.apache.axis.client.Call.invoke(Call.java:1691)
	at
it.matteo.SyncWorkers.DonorSyncClient.wsSync(DonorSyncClient.java:325)
	at
it.matteo.SyncWorkers.DonorSyncClient.run(DonorSyncClient.java:201)

Using "netstat" I can see in the client lots (about one thousand) open
socket connections in CLOSE_WAIT state. It seems that terminating this ws
client process makes the OS allowed to correctly close these (too many)
opened sockets.

I thought that after each "invoke" the used socket would be closed, but each
socket remains open, and I can't figure out why.
I expected the sockets to be reused, but each time a socket is opened, it
remais opened in CLOSE_WAIT state and a new one is taken, until no more
sockets can be opened.

CLOSE_WAIT is a state without timeout. When a socket is in CLOSE_WAIT state
the OS is waiting the process to release the socket. Isn't it?

The server wich publishes the web service is tomcat4, connected to
apache_1.3 using mod_jk2.

So, I'm trying to figure out what's wrong...
Any help would be appreciated.
Thank you in advance.

Bye,
Matteo.