Chris Ochs created JRUBY-6607:
---------------------------------
Summary: TCPSocket connect failure inside Timeout leaves orphaned
sockets
Key: JRUBY-6607
URL: https://jira.codehaus.org/browse/JRUBY-6607
Project: JRuby
Issue Type: Bug
Components: Standard Library
Affects Versions: JRuby 1.6.7
Environment: ubuntu linux
Reporter: Chris Ochs
Assignee: Thomas E Enebo
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.
<code>
require 'timeout'
require 'socket'
begin
Timeout.timeout(1) do
sock = TCPSocket.new('10.255.255.1', 80)
end
rescue Timeout::Error => e
puts e.message
end
sleep 1000
</code>
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email