ThreadError w/WEBrick

I have a WEBrick server that runs fine for over three days, and then starts
dumping the following error to stderr at a rate of about a gigabyte per half
hour:

[2003-11-25 11:15:02] ERROR ThreadError: stopping only thread
note: use sleep to stop forever
/usr/lib/ruby/1.8/thread.rb:276:in `stop’

It has only happened twice so far, so I haven’t been able to get a lot more
information. I’ll continue trying to debug the problem, but if someone has
any ideas as to what could cause this, I’d be grateful. It’s hard to debug
something that waits three days to happen.

I’m running Ruby 1.8.1preview2 on Debian Linux.

Thanks,

Nathaniel

<:((><

A few more things:

  • As far as I can tell, the only place thread.rb line 276 gets called is
    from webrick/server.rb line 90. I do not use a Queue anywhere in my code.

  • Can someone give me an explanation of what “ThreadError: stopping only
    thread” means? What is the general case that causes this error to be raised?

  • Why don’t I get a better backtrace for this error? The code (that I’m
    assuming is calling it) in webrick/server.rb is protected by a rescue block
    which should print out the full backtrace. Yet all I get is the one line.

  • Any ideas on how to get more information? I’m having trouble thinking of
    things to try with the process taking so long before it dies.

My plan at this point is to set up something to put the server under an
artificially heavy load, and see if the problem will show up faster. Any
ideas, thoughts, suggestions or fixes would be appreciated, though.

Thanks,

Nathaniel

<:((><

···

Nathaniel Talbott [mailto:nathaniel@NOSPAMtalbott.ws] wrote:

I have a WEBrick server that runs fine for over three days,
and then starts dumping the following error to stderr at a
rate of about a gigabyte per half hour:

[2003-11-25 11:15:02] ERROR ThreadError: stopping only thread
note: use sleep to stop forever
/usr/lib/ruby/1.8/thread.rb:276:in `stop’

It has only happened twice so far, so I haven’t been able to
get a lot more information. I’ll continue trying to debug
the problem, but if someone has any ideas as to what could
cause this, I’d be grateful. It’s hard to debug something
that waits three days to happen.

I’m running Ruby 1.8.1preview2 on Debian Linux.

- Can someone give me an explanation of what "ThreadError: stopping only
thread" means? What is the general case that causes this error to be
raised?

svg% ruby -e 'Thread.new { Thread.stop }'
svg%

svg% ruby -e 'Thread.stop'
-e:1:in `stop': stopping only thread (ThreadError)
        note: use sleep to stop forever from -e:1
svg%

Guy Decoux

Interesting… so, if calling Thread#stop causes an error, why is it called
from thread.rb line 276? Why does it even exist?

Nathaniel

<:((><

···

ts [mailto:decoux@moulon.inra.fr] wrote:

  • Can someone give me an explanation of what “ThreadError:
    stopping
    only thread” means? What is the general case that causes
    this error
    to be raised?

svg% ruby -e ‘Thread.new { Thread.stop }’
svg%

svg% ruby -e ‘Thread.stop’
-e:1:in `stop’: stopping only thread (ThreadError)
note: use sleep to stop forever from -e:1
svg%

Ah, I see… Thread.stop raises an error if it is called
when there is only one thread. So, it seems that a good line of
investigation would be finding out why all the threads are dead, eh?

Thanks Guy,

Nathaniel

<:((><

···

Nathaniel Talbott [mailto:nathaniel@NOSPAMtalbott.ws] wrote:

ts [mailto:decoux@moulon.inra.fr] wrote:

  • Can someone give me an explanation of what “ThreadError:
    stopping
    only thread” means? What is the general case that causes
    this error
    to be raised?

svg% ruby -e ‘Thread.new { Thread.stop }’
svg%

svg% ruby -e ‘Thread.stop’
-e:1:in `stop’: stopping only thread (ThreadError)
note: use sleep to stop forever from -e:1
svg%

Interesting… so, if calling Thread#stop causes an error,
why is it called from thread.rb line 276? Why does it even exist?