From: KOSAKI Motohiro Date: 2011-04-09T01:13:57+09:00 Subject: [ruby-core:35662] Re: [Ruby 1.9 - Bug #4558][Open] TestSocket#test_closed_read fails after r31230 2011/4/8 Eric Wong : > KOSAKI Motohiro wrote: >> > ---------------------------------------- >> > Bug #4558: TestSocket#test_closed_read fails after r31230 >> > http://redmine.ruby-lang.org/issues/4558 >> >> I think current rb_io_close() is broken. We have to call rb_thread_fd_close() >> before releasing GVL. >> >> Eric, Am I missing something? > > You are correct. > > I can't reproduce the test failure on x86_64-linux but the > following patch should fix a race condition: > > diff --git a/io.c b/io.c > index 7ce7148..b79cc5e 100644 > --- a/io.c > +++ b/io.c > @@ -3685,8 +3685,8 @@ rb_io_close(VALUE io) > � � if (fptr->fd < 0) return Qnil; > > � � fd = fptr->fd; > - � �rb_io_fptr_cleanup(fptr, FALSE); > � � rb_thread_fd_close(fd); > + � �rb_io_fptr_cleanup(fptr, FALSE); After while thinking, I conclude I was wrong. If rb_io_fptr_cleanup() raise a exception, We don't have to kill other threads. So, now I'm incline to revert r31230. Hmm...