From: Eric Wong Date: 2009-10-22T14:26:14+09:00 Subject: [ruby-core:26224] Re: [Bug #2250] IO::for_fd() objects' finalization dangerously closes underlying fds Mike Pomraning 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.