Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Ruby Tempfile can cause unexpected infinite loop in REE 1.8.7
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Nate Westheimer  
View profile  
 More options Apr 10 2012, 7:08 pm
From: Nate Westheimer <nate.westhei...@gmail.com>
Date: Tue, 10 Apr 2012 19:08:06 -0400
Local: Tues, Apr 10 2012 7:08 pm
Subject: Re: Ruby Tempfile can cause unexpected infinite loop in REE 1.8.7

Ahh, shoot. Thanks. Seems Google Groups had just appended a period to the
hyperlink in the archives. Thanks and sorry for the email clutter.
N

On Tue, Apr 10, 2012 at 7:04 PM, Michael Chletsos <mpchl...@gmail.com>wrote:

> take the period out of the link

> https://github.com/twitter/rubyenterpriseedition187-248/commit/83fc22

> On Tue, Apr 10, 2012 at 1:02 PM, Chehai WU <wuche...@gmail.com> wrote:
> > The link works for me.

> > On Tue, Apr 10, 2012 at 2:15 PM, Nate Westheimer <
> nate.westhei...@gmail.com>
> > wrote:

> >> Hey All,

> >> That link to Twitter's GH is broken. Can anyone point me to a
> replacement
> >> for this?

> >> Thanks,
> >> Nate

> >> On Thursday, August 25, 2011 1:25:03 AM UTC-4, WU Chehai wrote:

> >>> Thanks very much! We are going to use your patch.

> >>> On Jul 29, 11:03 am, Evan Weaver <ewea...@gmail.com> wrote:
> >>> > We ran into this bug in Kiji and fixed it the following
> >>> > way:
> https://github.com/twitter/rubyenterpriseedition187-248/commit/83fc22...

> >>> > It was causing a horrible fault for us where the readfds for the curr
> >>> > thread would get nulled out; thus you wait on nothing for the full
> >>> > timeout (in Net::HTTP) in this case.

> >>> > REE also calls rb_gc_finalize_deferred() at the end of a collection,
> >>> > so I think you can apply the same patch.

> >>> > Evan

> >>> > On Tue, Jan 18, 2011 at 5:45 PM, WU Chehai <wuche...@gmail.com>
> wrote:
> >>> > > Actually, regular Ruby 1.8.7-p330 does not has this issue.

> >>> > > The regular Ruby 1.8.7 finalizes objects every time a node is
> evaled
> >>> > > if some conditions are met, so the temp file object (temp) is
> >>> > > finalized before the thread exists. Everything should be fine.

> >>> > > Therefore, this is a bug in current REE 1.8.7

> >>> > > On Jan 17, 4:34 pm, WU Chehai <wuche...@gmail.com> wrote:
> >>> > >> Hi, all

> >>> > >> The following code ends up an infinite loop

> >>> > >> require "tempfile"
> >>> > >> GC.stress = true
> >>> > >> t = Thread.new do
> >>> > >>   temp = Tempfile.new("tmp")
> >>> > >>   temp << "something"
> >>> > >>   temp = nil
> >>> > >>   h = Hash.new
> >>> > >> end
> >>> > >> t.join

> >>> > >> Our analysis shows that there is a race condition in REE 1.8.7:

> >>> > >> - When a thread finishes running, REE/Ruby dequeues it
> >>> > >> (rb_thread_remove)  from the global thread list and calls
> >>> > >> rb_thread_schedule in order to schedule another thread to run.

> >>> > >> - rb_thread_schedule invokes  rb_gc_finalize_deferred before
> >>> > >> scheduling another thread.

> >>> > >> - rb_gc_finalize calls finalizer on Ruby Tempfile object. The
> >>> > >> finalizer closes a file descriptor by calling rb_thread_fd_close

> >>> > >> - rb_thread_fd_close has a loop to iterate over all threads.

> >>> > >> - However, the current thread is already dequeued (it points to
> >>> > >> other
> >>> > >> threads, but no threads point back to it), so the loop is actually
> >>> > >> an
> >>> > >> infinite loop.

> >>> > >> We believe this issue also exists in regular Ruby 1.8.7, but we
> >>> > >> cannot
> >>> > >> reproduce it. Is this a bug in REE 1.8.7?

> >>> > >> Thanks

> >>> > > --
> >>> > > You received this message because you are subscribed to the Google
> >>> > > Groups "Ruby Enterprise Edition" group.
> >>> > > To post to this group, send email to emm-ruby@googlegroups.com.
> >>> > > To unsubscribe from this group, send email to
> >>> > > emm-ruby+unsubscribe@googlegroups.com.
> >>> > > For more options, visit this group
> >>> > > athttp://groups.google.com/group/emm-ruby?hl=en.

> >> --
> >> You received this message because you are subscribed to the Google
> Groups
> >> "Ruby Enterprise Edition" group.
> >> To view this discussion on the web visit
> >> https://groups.google.com/d/msg/emm-ruby/-/bbyHMt0GSDkJ.

> >> To post to this group, send email to emm-ruby@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> emm-ruby+unsubscribe@googlegroups.com.
> >> For more options, visit this group at
> >> http://groups.google.com/group/emm-ruby?hl=en.

> > --
> > You received this message because you are subscribed to the Google Groups
> > "Ruby Enterprise Edition" group.
> > To post to this group, send email to emm-ruby@googlegroups.com.
> > To unsubscribe from this group, send email to
> > emm-ruby+unsubscribe@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/emm-ruby?hl=en.

> --
> You received this message because you are subscribed to the Google Groups
> "Ruby Enterprise Edition" group.
> To post to this group, send email to emm-ruby@googlegroups.com.
> To unsubscribe from this group, send email to
> emm-ruby+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/emm-ruby?hl=en.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.