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
Ruby Tempfile can cause unexpected infinite loop in REE 1.8.7
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  8 messages - Collapse all  -  Translate all to Translated (View all originals)
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
 
WU Chehai  
View profile  
 More options Jan 17 2011, 7:34 pm
From: WU Chehai <wuche...@gmail.com>
Date: Mon, 17 Jan 2011 16:34:00 -0800 (PST)
Subject: Ruby Tempfile can cause unexpected infinite loop in REE 1.8.7
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 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.
WU Chehai  
View profile  
 More options Jan 18 2011, 8:45 pm
From: WU Chehai <wuche...@gmail.com>
Date: Tue, 18 Jan 2011 17:45:01 -0800 (PST)
Local: Tues, Jan 18 2011 8:45 pm
Subject: Re: Ruby Tempfile can cause unexpected infinite loop in REE 1.8.7
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:


 
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.
Evan Weaver  
View profile  
 More options Jul 29 2011, 2:03 pm
From: Evan Weaver <ewea...@gmail.com>
Date: Fri, 29 Jul 2011 11:03:19 -0700
Local: Fri, Jul 29 2011 2:03 pm
Subject: Re: Ruby Tempfile can cause unexpected infinite loop in REE 1.8.7
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


 
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.
WU Chehai  
View profile  
 More options Aug 25 2011, 1:25 am
From: WU Chehai <wuche...@gmail.com>
Date: Wed, 24 Aug 2011 22:25:03 -0700 (PDT)
Local: Thurs, Aug 25 2011 1:25 am
Subject: Re: Ruby Tempfile can cause unexpected infinite loop in REE 1.8.7
Thanks very much! We are going to use your patch.

On Jul 29, 11:03 am, Evan Weaver <ewea...@gmail.com> wrote:


 
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.
Nate Westheimer  
View profile  
 More options Apr 10 2012, 5:15 pm
From: Nate Westheimer <nate.westhei...@gmail.com>
Date: Tue, 10 Apr 2012 14:15:02 -0700 (PDT)
Local: Tues, Apr 10 2012 5:15 pm
Subject: Re: Ruby Tempfile can cause unexpected infinite loop in REE 1.8.7

Hey All,

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

Thanks,
Nate


 
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.
Chehai WU  
View profile  
 More options Apr 10 2012, 7:02 pm
From: Chehai WU <wuche...@gmail.com>
Date: Tue, 10 Apr 2012 16:02:40 -0700
Local: Tues, Apr 10 2012 7:02 pm
Subject: Re: Ruby Tempfile can cause unexpected infinite loop in REE 1.8.7

The link works for me.

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


 
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.
Michael Chletsos  
View profile  
 More options Apr 10 2012, 7:04 pm
From: Michael Chletsos <mpchl...@gmail.com>
Date: Tue, 10 Apr 2012 13:04:15 -1000
Local: Tues, Apr 10 2012 7:04 pm
Subject: Re: Ruby Tempfile can cause unexpected infinite loop in REE 1.8.7
take the period out of the link

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


 
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.
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:


 
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.
End of messages
« Back to Discussions « Newer topic     Older topic »