From: Nobuyoshi Nakada Date: 2010-10-24T14:48:29+09:00 Subject: [ruby-core:32893] Re: [Ruby-Bug#3840][Open] Ruby 1.9.2p0 crashes using Rails 3.0 on repeated browser refresh Hi, At Thu, 16 Sep 2010 21:40:03 +0900, Sean O'Neil wrote in [ruby-core:32428]: > I can eliminate this crash by changing the Ruby source to > check for NULL before referencing the pointer. However, it > may only hide the issue, which may come back to bite me > later. So, does this sound like a problem that needs to be > fixed in the Ruby code, or a thread-safety issue in Rails? Your investigation seems correct, and I agree that it should be noticed earlier. I think Rails has a thread-safety issue but the crash is definitely a bug of Ruby itself. Does this patch fix it? diff --git a/io.c b/io.c index 4b8d34a..67d97f2 100644 --- a/io.c +++ b/io.c @@ -1722,6 +1722,7 @@ fill_cbuf(rb_io_t *fptr, int ec_flags) if (fptr->rbuf_len == 0) { READ_CHECK(fptr); if (io_fillbuf(fptr) == -1) { + rb_io_check_closed(fptr); ds = dp = (unsigned char *)fptr->cbuf + fptr->cbuf_off + fptr->cbuf_len; de = (unsigned char *)fptr->cbuf + fptr->cbuf_capa; res = rb_econv_convert(fptr->readconv, NULL, NULL, &dp, de, 0); -- Nobu Nakada