# Unhandled exception in thread causes ruby to lose control

**URL:** <https://www.ruby-forum.com/t/unhandled-exception-in-thread-causes-ruby-to-lose-control/55774>\
**Category:** Ruby\
**Created:** [March 23, 2006, 7:23pm UTC](https://www.ruby-forum.com/t/unhandled-exception-in-thread-causes-ruby-to-lose-control/55774 "2006-03-23T19:23:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shea\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ecccb3/32.png) [@Shea\_M](https://www.ruby-forum.com/u/Shea_M)\
**Post date:** [March 23, 2006, 7:23pm UTC](https://www.ruby-forum.com/t/unhandled-exception-in-thread-causes-ruby-to-lose-control/55774/1 "2006-03-23T19:23:58Z")

</div>

`
Thread.abort_on_exception = true
t = Thread.new{
puts “here”
raise “exception”
}
sleep 3
puts “t thread is #{t.alive?}”
exit 0
`

The above code will cause ruby to eatup 100% cpu, for an infinite amount  
of time on win32. If Thread.abort\_on\_exception is set to false, things  
work as expected.

I think this is a bug. ruby 1.8.4 (2005-12-24) [i386-mswin32]

~S

---

<div class="post-metadata">

**Author:** ![Shea\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ecccb3/32.png) [@Shea\_M](https://www.ruby-forum.com/u/Shea_M)\
**Post date:** [March 23, 2006, 9:52pm UTC](https://www.ruby-forum.com/t/unhandled-exception-in-thread-causes-ruby-to-lose-control/55774/2 "2006-03-23T21:52:22Z")

</div>

Shea M. wrote:

> puts “t thread is #{t.alive?}”
> 
> exit 0
> 
> The above code will cause ruby to eatup 100% cpu, for an infinite amount  
> of time on win32.

WinXP pro, SP2: Code works just fine.

d:\temp\>tex.rb  
here  
d:/temp/tex.rb:5: exception (RuntimeError)  
from d:/temp/tex.rb:3

d:\temp\>

James
