2011/4/8 Eric Wong <normalperson / yhbt.net>: > KOSAKI Motohiro <kosaki.motohiro / gmail.com> 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_cl= ose() >> 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) > =A0 =A0 if (fptr->fd < 0) return Qnil; > > =A0 =A0 fd =3D fptr->fd; > - =A0 =A0rb_io_fptr_cleanup(fptr, FALSE); > =A0 =A0 rb_thread_fd_close(fd); > + =A0 =A0rb_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...