From: Mike Pomraning Date: 2009-06-05T11:26:30+09:00 Subject: [ruby-core:23710] [Bug #1567] socket.c silently discards internal listen(2) failures Issue #1567 has been updated by Mike Pomraning. File ruby-1.9.1-p129-socket_listen_2.patch added Mea culpa: the attached patch close(2)s socket fd if listen(2) fails inside TCPServer initialization. With respect to SystemCallError behavior, one can (on Linux, at least) verify behavior like so: $ cat /tmp/listen_fail.c #include /* gcc -fPIC -rdynamic -g -c -Wall listen_fail.c * gcc -shared -Wl,-soname,liblisten_fail.so.1 -o liblisten_fail.so.1 listen_fail.o -lc */ int listen(int s, int backlog) { errno = ENOBUFS; return -1; } $ basename `pwd` ruby-1.9.1-p129 # without patch $ LD_PRELOAD=/tmp/liblisten_fail.so.1 ./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb ./runruby.rb --extout=.ext -r socket -e 'TCPServer.new(1024)' $ # with patch $ LD_PRELOAD=/tmp/liblisten_fail.so.1 ./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb ./runruby.rb --extout=.ext -r socket -e 'TCPServer.new(1024)' -e:1:in `initialize': No buffer space available - listen(2) (Errno::ENOBUFS) from -e:1:in `new' from -e:1:in `
' ... and similarly for UNIXServer.new(...) ---------------------------------------- http://redmine.ruby-lang.org/issues/show/1567 ---------------------------------------- http://redmine.ruby-lang.org