From: Joseph McDonald Date: 2001-06-22T11:18:53+09:00 Subject: [ruby-talk:16737] socket bug I'm trying to track down a problem with sockets that I'm having. I am getting a couple of different errors. Here is the server: #!/usr/local/bin/ruby require 'socket' trap("CLD") { pid = Process.wait } s = TCPServer.new("0.0.0.0",6666) while(new_sock = s.accept) pid = fork if(pid == nil) line = new_sock.gets new_sock.print("got #{line}\n") new_sock.shutdown exit end end s.close Here is the client: #!/usr/local/bin/ruby require 'socket' 1.upto(100000) do |x| puts x w1 = TCPsocket.open("127.0.0.1", 6666) w1.print "hello server\n" ans1 = w1.readlines.to_s w1.shutdown end Sometimes the server will get errors such as: ./socketbug.rb ./socketbug.rb:6:in `wait': No child processes (Errno::ECHILD) from ./socketbug.rb:6 from ./socketbug.rb:5:in `call' from ./socketbug.rb:11 I've also seen this from the server: ./socketbug.rb ./socketbug.rb:10:in `accept': Bad file descriptor (Errno::EBADF) from ./socketbug.rb:10 Sometimes the client will bomb out with: 1198 ./client.rb:7:in `open': No buffer space available - "socket(2)" (Errno::ENOBUFS) from ./socketbug2.rb:7 from ./socketbug2.rb:5:in `upto' from ./socketbug2.rb:5 Sometimes the client will bomb out with: ./client.rb:7: [BUG] Segmentation fault ruby 1.6.4 (2001-06-04) [i386-freebsdelf4.3] Abort trap Anybody else experience something similiar? thanks, -joe