# This prog keeps stopping again and again

**URL:** <https://www.ruby-forum.com/t/this-prog-keeps-stopping-again-and-again/149438>\
**Category:** Ruby\
**Created:** [September 24, 2008, 10:01pm UTC](https://www.ruby-forum.com/t/this-prog-keeps-stopping-again-and-again/149438 "2008-09-24T22:01:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Junkone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e274bd/32.png) [@Junkone](https://www.ruby-forum.com/u/Junkone)\
**Post date:** [September 24, 2008, 10:01pm UTC](https://www.ruby-forum.com/t/this-prog-keeps-stopping-again-and-again/149438/1 "2008-09-24T22:01:28Z")

</div>

i have put enough exception handlers. but this prog keeps stalling  
after some time. how do i fix it.

Wed Sep 24 10:30:16 -0700 2008  
Wed Sep 24 10:30:22 -0700 2008  
c:/ruby/lib/ruby/1.8/openssl/buffering.rb:35:in `sysread': An existing connectio n was forcibly closed by the remote host. (Errno::ECONNRESET) from c:/ruby/lib/ruby/1.8/openssl/buffering.rb:35:in`fill\_rbuff’  
from c:/ruby/lib/ruby/1.8/openssl/buffering.rb:106:in `gets' from c:/ruby/lib/ruby/1.8/net/imap.rb:991:in`get\_response’  
from c:/ruby/lib/ruby/1.8/net/imap.rb:929:in  
`receive_responses' from c:/ruby/lib/ruby/1.8/net/imap.rb:922:in`initialize’  
from c:/ruby/lib/ruby/1.8/net/imap.rb:921:in `start' from c:/ruby/lib/ruby/1.8/net/imap.rb:921:in`initialize’  
from ./imDaveAlerts.rb:13:in `new' from ./imDaveAlerts.rb:13:in`doAlerts’  
from C:/toronto/app/helpers/myCron.rb:10  
from c:/ruby/lib/ruby/gems/1.8/gems/timeoutx-0.3.0/lib/  
timeoutx.rb:58:in  
`timeout’  
from C:/toronto/app/helpers/myCron.rb:7

require ‘imDaveAlerts’  
require “timeoutx”

while(true)

puts Time.now  
begin  
TimeoutX.timeout(15){  
begin  
a=DaveAlerts.new  
a.doAlerts()  
rescue Exception  
print Exception.to\_s  
end  
}  
rescue Exception  
print Exception.to\_s  
end  
sleep(5)  
end

---

<div class="post-metadata">

**Author:** ![Junkone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e274bd/32.png) [@Junkone](https://www.ruby-forum.com/u/Junkone)\
**Post date:** [September 25, 2008, 1:20am UTC](https://www.ruby-forum.com/t/this-prog-keeps-stopping-again-and-again/149438/2 "2008-09-25T01:20:26Z")

</div>

On 24.09.2008 21:58, Junkone wrote:

> i have put enough exception handlers. but this prog keeps stalling  
> after some time. how do i fix it.

Few things come to mind:

1. configuration on the target system (close after time)

2. why do you use sysread?

Kind regards

robert

---

<div class="post-metadata">

**Author:** ![Junkone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e274bd/32.png) [@Junkone](https://www.ruby-forum.com/u/Junkone)\
**Post date:** [September 25, 2008, 5:15pm UTC](https://www.ruby-forum.com/t/this-prog-keeps-stopping-again-and-again/149438/3 "2008-09-25T17:15:56Z")

</div>

On Sep 24, 4:29 pm, Robert K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Kind regards
> 
> ```
> robert
> 
> ```

sysread comes from Net\imap.  
i am using imap to connect to gmail to get my emails and IM myself.  
however, you can see i have enough exception handers. why does the  
exception not get caught and the loop continrues. otherwise why is the  
process not terminated by TimeoutX.timeout and the loop continues
