[#44036] [ruby-trunk - Feature #6242][Open] Ruby should support lists — "shugo (Shugo Maeda)" <redmine@...>

20 messages 2012/04/01

[#44084] [ruby-trunk - Bug #6246][Open] 1.9.3-p125 intermittent segfault — "jshow (Jodi Showers)" <jodi@...>

22 messages 2012/04/02

[#44156] [ruby-trunk - Feature #6265][Open] Remove 'useless' 'concatenation' syntax — "rosenfeld (Rodrigo Rosenfeld Rosas)" <rr.rosas@...>

45 messages 2012/04/06

[#44163] [ruby-trunk - Bug #6266][Open] encoding related exception with recent integrated psych — "jonforums (Jon Forums)" <redmine@...>

10 messages 2012/04/06

[#44303] [ruby-trunk - Feature #6284][Open] Add composition for procs — "pabloh (Pablo Herrero)" <pablodherrero@...>

57 messages 2012/04/12

[#44349] [ruby-trunk - Feature #6293][Open] new queue / blocking queues — "tenderlovemaking (Aaron Patterson)" <aaron@...>

10 messages 2012/04/13

[#44402] [ruby-trunk - Feature #6308][Open] Eliminate delegation from WeakRef — "headius (Charles Nutter)" <headius@...>

20 messages 2012/04/17

[#44403] [ruby-trunk - Feature #6309][Open] Add a reference queue for weak references — "headius (Charles Nutter)" <headius@...>

15 messages 2012/04/17

[#44533] [ruby-trunk - Bug #6341][Open] SIGSEGV: Thread.new { fork { GC.start } }.join — "rudolf (r stu3)" <redmine@...>

24 messages 2012/04/22

[#44630] [ruby-trunk - Feature #6361][Open] Bitwise string operations — "MartinBosslet (Martin Bosslet)" <Martin.Bosslet@...>

31 messages 2012/04/26

[#44648] [ruby-trunk - Feature #6367][Open] #same? for Enumerable — "prijutme4ty (Ilya Vorontsov)" <prijutme4ty@...>

16 messages 2012/04/26

[#44704] [ruby-trunk - Feature #6373][Open] public #self — "trans (Thomas Sawyer)" <transfire@...>

61 messages 2012/04/27

[#44748] [ruby-trunk - Feature #6376][Open] Feature lookup and checking if feature is loaded — "trans (Thomas Sawyer)" <transfire@...>

13 messages 2012/04/28

[ruby-core:44559] [ruby-trunk - Bug #6228] [mingw] Errno::EBADF in ruby/test_io.rb on ruby_1_9_3

From: "h.shirosaki (Hiroshi Shirosaki)" <h.shirosaki@...>
Date: 2012-04-23 15:18:30 UTC
List: ruby-core #44559
Issue #6228 has been updated by h.shirosaki (Hiroshi Shirosaki).


> Why do you think the same incorrect test code fails (consistently, not intermittently) on windows when only using -DFD_SETSIZE, but doesn't appear to fail on *nix? On Arch, I've not been able to repro when building using -DFD_SETSIZE=32767. This may indicate a lurking weakness in an _WIN32 MRI codepath (or winsock2 peculiarity) that doesn't exist (or does a better job of hiding) on *nix.
> 

This issue depends on the timing when IO object is GCed. GC of an object with the same fd must occur between open() and close().
I guess -DFD_SETSIZE=32767 would change memory usage and GC timing. MRI implementation is different between WIndows and Linux, so GC timing would differ.


> FYI, there's another recent issue on windows in which -DFD_SETSIZE=32767 exposes a SEGV with EventMachine with a simple `EM.run {}`. By default, EM sets FD_SETSIZE to 1024. Rebuilding ruby on windows without the FD_SETSIZE override fixes the SEGV. The EM issue is a separate issue than this one, but may be related. I haven't started investigating, so FYI.
> 

I think above issue is cause of `fd_array` buffer overflow.

typedef struct fd_set
{
        u_int   fd_count;
        SOCKET  fd_array[FD_SETSIZE];
} fd_set;

On EM, FD_SETSIZE = 1024 and fd_array[1024].
EM uses FD_SET() and FD_SET() seems rb_w32_fdset() on Windows.

https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L2458

In rb_w32_fdset(), FD_SETSIZE = 32767 since rb_w32_fdset is compiled with -DFD_SETSIZE=32767.

    if (i == set->fd_count) {
        if (set->fd_count < FD_SETSIZE) { // FD_SETSIZE = 32767
            set->fd_array[i] = s;                 // `i` could be over 1023
            set->fd_count++;
        }
    }

If above scenario is correct, FD_SETSIZE of Ruby should be equal or less then FD_SETSIZE of EM.

include/winsock2.h has FD_SET macro on mingw, but MRI undef FD_SET and uses rb_w32_fdset() function. It might be better that FD_SET() is macro instead of function.
----------------------------------------
Bug #6228: [mingw] Errno::EBADF in ruby/test_io.rb on ruby_1_9_3
https://bugs.ruby-lang.org/issues/6228#change-26116

Author: jonforums (Jon Forums)
Status: Assigned
Priority: Normal
Assignee: nobu (Nobuyoshi Nakada)
Category: test
Target version: 1.9.3
ruby -v: ruby 1.9.3p172 (2012-03-30 revision 35179) [i386-mingw32]


On Win7 32bit built with MinGW 4.6.2 using the RubyInstaller build recipes, I get the following test error:


sh-3.1$ ruby --version
ruby 1.9.3p172 (2012-03-30 revision 35179) [i386-mingw32]

sh-3.1$ make test-all TESTS='openssl fiddle psych zlib io json mkmf pathname stringio erb 
fileutils ruby/test_io.rb ruby/test_io_m17n.rb ruby/test_file.rb'

  7) Error:
test_lines(TestIO):
Errno::EBADF: Bad file descriptor
    c:/Users/Jon/Documents/RubyDev/ruby-git/test/ruby/test_io.rb:33:in `close'
    c:/Users/Jon/Documents/RubyDev/ruby-git/test/ruby/test_io.rb:33:in `rescue in block in pipe'
    c:/Users/Jon/Documents/RubyDev/ruby-git/test/ruby/test_io.rb:30:in `block in pipe'


-- 
http://bugs.ruby-lang.org/

In This Thread