On Dec 11, 2003, at 16:10, nobu.nokada / softhome.net wrote:

> At Fri, 12 Dec 2003 03:08:58 +0900,
> ts wrote:
>> N> I tried it against the latest Ruby CVS, and it still crashes. It 
>> seemed
>> N> to take (subjectively) longer to crash, though. Interestingly, 2 
>> out of
>> N> 3 runs gave me this instead of a segfault:
>>
>>  Well, look where it crash.
>>
>>  With the previous version normally you have a crash in
>>    * rb_thread_restore_content()
>>    * and localjump_destination()
>>
>>  normally with the new patch (if I'm right), you have just a crash in
>>    * localjump_destination()
>
> Then, it'd be simple.

Maybe for you... but for me, I'm very grateful for Ruby super-heroes :-)

Anyhow, I tried this patch, and I no longer get a segfault or any other 
kind of crash, which is great!

Unfortunately, with a slight modification to keep the killer running 
even if some threads time out, the killer will now lock completely 
sometimes with the same characteristics as reported in 
[ruby-talk:87519]. Here's the line from top:

    PID USER     WCHAN     STAT %CPU %MEM   TIME COMMAND
   5502 ntalbott rt_sigsus S     0.0 21.8   1:15 bin/ruby 
/home/ntalbott/sandbox/killer.rb

Not only that, but it's hard to reproduce this; under production, the 
process will run for hours without it happening, and even with this 
test case I've only had it happen once. I'm continuing to try different 
variants, and will let you know if I find one that fails more 
consistently.

This 'rt_sigsuspend problem' is why I enabled pthread in the first 
place, but apparently that doesn't really fix it. Any guesses? I have a 
hunch that Net::HTTP (and the underlying native code) are interacting 
poorly with threads (my full WEBrick server uses Net::HTTP as well), 
but it's only a guess.

Here's the new killer.rb:

   require 'thread'
   require 'net/http'

   threads = []

   STDOUT.sync = true
   200.times do
     threads << Thread.new do
       h = Net::HTTP::new('localhost', 2000)
       loop do
         h.get('/hello')
         print('.')
       end
     end
   end

   sleep(60 * 10)


Thanks,


Nathaniel

<:((><