Project

General

Profile

Backport #670

select doesn't handle fd's > FD_SETSIZE very well

Added by rogerdpack (Roger Pack) almost 12 years ago. Updated almost 3 years ago.

Status:
Rejected
Priority:
Normal
[ruby-core:19403]

Description

=begin
The main motivation for reporting this bug is that currently on win32 [any version] if you try to pass more than 64 sockets to select, it ignores the 65th onward. This limit is not obeyed by Ruby currently and therefore some sockets will never select.

I'd first suggest raising an error if more than 64 total sockets are passed [to the most recent thread that called select?]

While examining it, this same aspect [too many or too high of numbered selects] is also seen to cause some problems on other platforms.

In the test cases attached, sometimes Mac OS X consistently crashes, sometimes Linux does. Depends on the test.

I'd bet that these problems also continue for Ruby 1.9 as well.

How to run tests:
first touch file 'abc' # used for some tests
then run ulimit -n 2000 # if this fails, you may need to run "sudo bash" first
then run the files.

To ruby's credit, without having first run the ulimit, above, most platforms don't seg fault [though windows still has the difficulty mentioned], so this isn't life critical.

Note that in Linux/OS X if a file descriptor's "number" is > FD_SETSIZE then it will be ignored by select. In Windows if the "total number of descriptors" past to select is > FD_SETSIZE then those past FD_SETSIZE will be ignored.

Thanks much!
-=Roger
=end


Files

test_crashes_os_x.rb (1020 Bytes) test_crashes_os_x.rb rogerdpack (Roger Pack), 10/21/2008 08:01 AM
test_select_crashes_linux.rb (1003 Bytes) test_select_crashes_linux.rb rogerdpack (Roger Pack), 10/21/2008 08:01 AM
test_select_hangs_on_linux.rb (998 Bytes) test_select_hangs_on_linux.rb rogerdpack (Roger Pack), 10/21/2008 08:01 AM
test_select_hangs_windows.rb (1017 Bytes) test_select_hangs_windows.rb rogerdpack (Roger Pack), 10/21/2008 08:01 AM
socket.diff (1.86 KB) socket.diff rogerdpack (Roger Pack), 02/08/2010 11:13 PM

Related issues

Related to Ruby master - Bug #755: select in windows errantly accepts too many fd'sClosedusa (Usaku NAKAMURA)11/16/200812/24/2008Actions

Also available in: Atom PDF