Is thread dead?

Hi guys,
Here is piece of my code:


def executeAgent()

# establish telnet connection etc.

    agent.cmd('String' => "a_command") do |c| #logs to output as well as to
local file
  rescue TimeoutError => e
    #exception handling + logging
rescue Errno::ECONNRESET, Errno::ECONNABORTED => e
  #exception handling + logging

#logging that this function is going to finish because end prompt was
end #executeAgent

agentTr = do
    rescue Exception => e
        print("#{__FILE__} #{__LINE__}: executeAgent - #{e}\n")

while true
puts "agentTr alive" if agentTr.alive?

agent.cmd('String' => "a_command") - should never end, so logging to
local file everything what a_command throws should (in theory) never
ends as well (if of course above exceptions wouldn't occur - Timeout,
But unfortunately looks like agentTr suddenly evaporates (agentTr.alive?
returns false). Furthermore I've got none of logs from rescues blocks of
code and moreover from the end of executeAgent function. Additionally
I've got none of logs from block.

Such situation appears after several hours (randomly)
What is going on? Maybe something is not correct with exceptions
handling or something like that.
If a_command finishes end prompt should be in my logs, if any timeout
occur (in case a_command is suspended) a log should be in logs as well

I will be appreciated for any help.

Thanks in advance.

Posted via