From: "rubydev.deweerdt" Date: 2002-03-14T03:38:23+09:00 Subject: Re:Threads + Sockets == Instability? I've come up with the same problems as I write a little "tcp proxy" script. A thread TA read from socket A and wrote the input to socket B, a second thread TB read from socket B an wrote to socket A it seems that deadlocks happen because each thread locks the socket so that reading and writing is not thread safe > I recently wrote some simple scripts that spawn lots of threads (up to > 100), each doing a little bit of network stuff (either TCP or UDP). > These were quick and easy to write, but they often crashed randomly or > died with a "deadlock" failure under both Ruby 1.6 and 1.7. > > Are there examples of stable Ruby programs that do this kind of thing? > Or have I just stressed the system enough to uncover new bugs? One > such bug I found is described at > http://www.ruby-lang.org/cgi-bin/ruby-bugs/incoming?id=270 -- the > program seems to randomly corrupt the C stack. > > I am trying to track down and fix these bugs. Anybody have any tips > for me? > > -- > matt > "Acc�dez au courrier �lectronique de La Poste : www.laposte.net ; 3615 LAPOSTENET (0,13 �/mn) ; t�l : 08 92 68 13 50 (0,34�/mn)"