D
David Rodriguez
Hi All
I am moving a software from ruby 1.8.5 to 1.9.1. We have a multi thread
TCP server and the code looks like:
@csock = TCPServer.new(@host, port)
@server_thread_id = Thread.new { server() }
def server()
while (session_sock = @csock.accept)
worker_thread = Thread.new {
handle_connection(session_sock)}
end
end
But when I moved to 1.9.1, I downloaded 1.9.1p376, it accepted all the
connections but sometimes some of then, the thread did not dequeue any
packets after all. So I google and I found a bug
http://redmine.ruby-lang.org/issues/show/1525
which seems related.So I applied the patch suggested on that thread (I
attached the patch) and everything worked just fine after that. My
question is: should I code the server in a different way to make it
multithread safe using ruby 1.9.1?
Thanks,
David Rodriguez
Attachments:
http://www.ruby-forum.com/attachment/4322/vm_deadlock_fix.diff
I am moving a software from ruby 1.8.5 to 1.9.1. We have a multi thread
TCP server and the code looks like:
@csock = TCPServer.new(@host, port)
@server_thread_id = Thread.new { server() }
def server()
while (session_sock = @csock.accept)
worker_thread = Thread.new {
handle_connection(session_sock)}
end
end
But when I moved to 1.9.1, I downloaded 1.9.1p376, it accepted all the
connections but sometimes some of then, the thread did not dequeue any
packets after all. So I google and I found a bug
http://redmine.ruby-lang.org/issues/show/1525
which seems related.So I applied the patch suggested on that thread (I
attached the patch) and everything worked just fine after that. My
question is: should I code the server in a different way to make it
multithread safe using ruby 1.9.1?
Thanks,
David Rodriguez
Attachments:
http://www.ruby-forum.com/attachment/4322/vm_deadlock_fix.diff