>>>>> "I" == Idan Sofer <idan / idanso.dyndns.org> writes:

I> I suppose it is a change I have to apply to the ruby source itself? 

 Yes, like I've said put rb_thread_restore_context() in critical phase
 (same for rb_thread_save_context()).

 It's easy to understand :
   1) a thread is stopped by the timer
   2) ruby run the scheduler
   3) when ruby call rb_thread_restore_context()
       * it extend the stack (extend_stack)
       * the current thread is with rb_trap_immediate = 1
       * ruby receive VTALRM it re-run the scheduler, at this step the
         frame pointers for this thread *can* be invalid (ruby has not yet
	 make the complete copy)

 Now if the new thread call the GC, it exist at least one thread with
 invalid frame pointers and you have the bug

#0  0x4117f2fb in mark_locations_array (x=0xc0000000, n=-1073796479) at gc.c:353
#1  0x4118007a in rb_gc_mark_frame (frame=0x40cc2744) at gc.c:958
                                    ^^^^^^^^^^^^^^^^
 this frame pointer is invalid.


>> p.s. : you must have a bug in your source
I> ??

 Well, if I'm right it exist a possibility that your script will be blocked
 in a while loop and never accept new connection : not sure.


Guy Decoux