File descriptor leak with sockets

This is with jruby-1.6.7

I found a rather major file descriptor leak using the dalli memcache
client this weekend. One of our memcache servers went down, and
dalli’s logic for reconnecting to the server ended up creating
thousands of sockets. lsof showed them as ‘cannot identify protocol’.

My question is. If I’m not keeping a reference to the socket,
shouldn’t it get GC’d and finalized even if it’s not closed correctly?
I’m still investigating the dalli client to track down exactly where
the leak happens, it’s possible it’s holding a reference to old
sockets, although I didn’t see that at first glance through the code.

Chris

unfortunately the GC only runs “sometimes” but in general it should
probably clean those up. You might be able to find where the rogue
references are being held by using jmap or the like.