[Shards-general] Curious ArgumentError with IO.fdwalk on 1.9.3

Eric Wong normalperson at yhbt.net
Sat Mar 10 20:21:43 UTC 2012


Daniel Berger <djberg96 at gmail.com> wrote:
> Here's an interesting bug I ran into with Ruby 1.9.3-p125 on Solaris
> 10 built with gcc.
> 
> ArgumentError(<The given fd is not accessible because RubyVM reserves it>)

This is because the timer thread pipe (new in 1.9.3) is reserved and
Ruby can't deal with it being closed.  There's a new rb_reserved_fd_p()
function which lets you tell if it's reserved, so I think IO.fdwalk
should just skip the FD if rb_reserved_fd_p() returns false.

And for systems without rb_reserved_fd_p(), you can just make a
macro that returns 0.

Something like this:

#ifndef HAVE_RB_RESERVED_FD_P
static int my_reserved_fd_p(int fd)
{
	return 0;
}
#define rb_reserved_fd_p(fd) my_reserved_fd_p((fd))
#endif


More information about the shards-general mailing list