This is the same problem as described in http://jira.codehaus.org/browse/JRUBY-6498.
If you wrap a connect inside a Timeout, and the timeout expires, it leaves an orphaned socket in whatever state it was in when the timeout expired. In the following code, even after the timeout the socket is still in SYN_SENT, and after a short time it shows up via lsof as an orphaned socket with the status cannot identify protocol. In our case this took down a cluster of 80 jruby servers when our memcache servers reached their connection limit. The memcache client kept trying to connect, creating thousands of these things and we ran out of open file descriptors within minutes.
sock = TCPSocket.new('10.255.255.1', 80)
rescue Timeout::Error => e