[Gridflow-dev] ruby 1.8

Mathieu Bouchard matju at artengine.ca
Mon Oct 9 16:05:17 EDT 2006


hey. GridFlow is back to working with Ruby 1.8 ! Please report to me if it 
crashes more often with Ruby 1.8 than with Ruby 1.9. Also please report if 
you find any reason for any random-looking crashes, because I want to get 
rid of all of the crashes ASAP. GridFlow needs to get back to the level of 
stability that it had when it was GridFlow 0.5 :)

---------- Forwarded message ----------
From: Mathieu Bouchard <matju at artengine.ca>
Reply-To: ruby-core at ruby-lang.org
To: ruby-core at ruby-lang.org
Subject: Re: Patch to Ruby in 2003

On Sun, 23 Jul 2006, Yukihiro Matsumoto wrote:
> In message "Re: Patch to Ruby in 2003"
>    on Sun, 23 Jul 2006 01:11:00 +0900, Mathieu Bouchard 
<matju at artengine.ca> writes:
> |All versions of Ruby, up to some early 1.9, may perform an incomplete
> |mark, due to assuming that the system call-stack is empty at the moment
> |ruby_init is called. Then the sweep deletes objects still in use, which 
by
> |chain reaction corrupts memory, leads to segfaults, bus errors, unknown
> |node types, failed assertions, and various other forms of suicide.
>
> Can you point out function names that your mentioning patch is applied? 
My memory is very weak, and I couldn't find big difference in stack start
> detection between 1.8 and 1.9, except for ia64 support. I guess I am 
missing something.

I didn't reply because I postponed this to a time when I could sit and 
actually figure this out because, you see, I don't have any more of an 
answer than
you have. I couldn't find it in the ChangeLog, maybe I'm reading it too 
fast ("too diagonally"), and I don't remember how the fix was made because 
after
a bit of reading it I figured out that it seemed too involved for me 
(though I was comfortable with probing the stack myself until I trap my 
own segfault
- that was easy).

Yesterday I have tried an idea that I got a few weeks ago, which is to do:

static t_clock *hack;
extern "C" void Init_stack(void*);
static void ruby_stack_end_hack () {
   int bogus;
   Init_stack(&bogus);
   clock_free(hack);
}

extern "C" void gridflow_setup () {
   [...]
   hack = clock_new((void*)0,(t_method)ruby_stack_end_hack);
   clock_delay(hack,0);
}

where clock_new, clock_delay, clock_free, are functions of the built-in 
scheduler of the PureData programming language. This causes Init_stack to 
be
called from a moment when the stack is closer to empty, and pretty much as 
empty as it can get during all runtime. However this causes Ruby to be
somewhat vulnerable during startup.

The big upside to this, is that it's now much easier to install GridFlow, 
because Ruby 1.8 is a lot more readily available than Ruby 1.9, especially 
to
newbies. So basically I'm back to what it was before glibc began doing 
weird things to my stack end detector(s).

  _ _ __ ___ _____ ________ _____________ _____________________ ...
| Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju
| Freelance Digital Arts Engineer, Montréal QC Canada


More information about the Gridflow-dev mailing list