André, Would a connection pool help here? The connections wouldn't go out of scope and instead be recycled, so you wouldn't be dependent on GC to clean them up. The pool should limit the number of sockets created.
Paul On Fri, Mar 25, 2011 at 6:57 PM, André Warnier <a...@ice-sa.com> wrote: > I am wondering if this could not create the same phenomenon which I have > seen with another app a while ago : a number of connections, at the OS > level, left in the CLOSE_WAIT state until the next GC. > Scenario : > - a Java "connection object" is created, which contains a socket (OS-level > structure) > - the object is used, and then discarded, but without explicitly closing > the embedded socket > - the object, now without reference to it within Java, sits on the Heap, > waiting to be GC-ed > - but because it still has this unclosed socket in it, that socket still > exists at the OS level, and cannot be reclaimed by the OS > > Slowly, such CLOSE_WAIT sockets accumulate, and in Linux at least, when > there are a few hundreds of them, the system suddenly becomes irresponsive > to TCP/IP in general (no new connections can be created for example). > > Easy to diagnose : do this a few times and watch the output of > "netstat -pan | grep CLOSE_WAIT" > Then force a GC, and look again. > > (Of course then, with a Tomcat version < 7.0.11) > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > >