Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.6.7
-
Fix Version/s: JRuby 1.6.8, JRuby 1.7.0.pre1
-
Component/s: Standard Library
-
Labels:None
-
Environment:ubuntu linux
-
Number of attachments :
Description
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>
Issue Links
- duplicates
-
JRUBY-6498
Net::Http does not close socket when open_timeout is exceeded
-
Activity
| Field | Original Value | New Value |
|---|---|---|
| Link | This issue is related to JRUBY-6591 [ JRUBY-6591 ] |
| Link | This issue is related to JRUBY-6591 [ JRUBY-6591 ] |
| Link |
This issue duplicates |
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Assignee | Thomas E Enebo [ enebo ] | Charles Oliver Nutter [ headius ] |
| Fix Version/s | JRuby 1.6.8 [ 18345 ] | |
| Fix Version/s | JRuby 1.7 [ 17049 ] | |
| Resolution | Fixed [ 1 ] |