On 21/08/2008, Michal Suchanek <hramrach / centrum.cz> wrote: > > With this test I get EBADF on ruby 1.8.5 after 107 iterations and on > 1.8.7 anfter 104 iterations, always. > > > ruby 1.8.5 (2006-08-25) [x86_64-linux] > > ruby 1.8.7 (2008-06-20 patchlevel 22) [x86_64-linux] > FWIW it also fails on OS X after 109 iterations, although with a completely different error message. ruby 1.8.6 (2008-08-11 patchlevel 287) [i686-darwin] Here the EBADF is reported by cat and ruby reports thread deadlock. Thanks Michal def try_analyze *words analyzer = IO.popen( 'cat', IO::RDWR ) res = [] t = Thread.new( (IO::for_fd analyzer.fileno),res){|fd,ary| while l = fd.gets do STDERR.putc 8 ary.push l end fd.close rescue nil # hopefully prevents zombie hordes } words.each{|w| STDERR.putc '.'[0] analyzer.puts w } analyzer.close_write rescue nil t.join end 1.upto(10000){|_| try_analyze *%w(a b c d e f g h i) STDERR.puts _ }