socket connect blocking on windows

W

William Morgan

Hello all,

RubyTorrent is having some trouble on Windows, because making new TCP
socket connections seem to block ALL running threads. For example, the
following code hangs under Windows (but not under Linux) until the
connection timeout is reached (20s):

require 'socket'

t = Thread.new do
while true
puts "in thread"
sleep 1
end
end

sleep 2

puts "connecting..."
h = TCPSocket.new('192.168.0.80', 80) # bogus ip
puts "connected!"

t.join

This issue was mentioned before [ruby-talk:105369], and patches have
been submitted [ruby-core:3154], [ruby-core:3182], but the problem seems
to persist, at least in Ruby 1.8.2 on Windows XP.

Was this ever addressed? Is there a workaround? RubyTorrent makes a lot
of TCP connections, and a 20-second global freeze for each failed
attempt is quite a performance hit on Windows.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top