Mike Pomraning <redmine / ruby-lang.org> wrote:
> Bug #2250: IO::for_fd() objects' finalization dangerously closes underlying fds
> http://redmine.ruby-lang.org/issues/show/2250

> 2. Observed behavior:
> 
> Instead, an IO object created by IO::for_fd(a_socket_fd) will attempt
> to close(2) its underlying socket fd upon finalization.

FWIW, I've been sticking IO objects created with IO.for_fd into a
global Array to workaround this behavior.

> 4. Why this is very bad:

I don't have an opinion on whether this behavior is bad or not.  I would
avoid repeatedly calling IO.for_fd on the same underlying file
descriptor regardless because it's less memory thrashing that way.