in reply to Re^2: Problem using threads and snmp
in thread Problem using threads and snmp

The "thread failed to start" is a red-herring/badly chosen error message. It simple means that the thread died.

The reason the thread dies is because you are asking it to:

$info = $sess->get($itens) or die "couldn't get info";

There are many reasons why the get() could fail. The first thing to do is get some more information than your error message gives. Appending $sess->error to your message would be a good start.

If that doesn't help you resolve the problem, try enabling debug:

$session->debug( DEBUG_ALL );

See the POD for details.

Once you know why that call is failing, you have a chance to do something about it.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

Replies are listed 'Best First'.
Re^4: Problem using threads and snmp
by rnery (Initiate) on Apr 16, 2008 at 13:51 UTC
    Hello BrowserUK, Thank you for your reply. The error that states is a timeout. What i'm going to try to do is a unique method for all threads . This method will create the snmpsession and do the snmpget. Of course i will have to lock the access to this method. I will keep you posted. Cheers.
      ... . Of course i will have to lock the access to this method ..
      Wouldn't that defeat the purpose of running the threads in parallel ?

      I'm uncomfortable with your implementation of the locking to obtain and send data. Subtle bugs in this type code are notoriously difficult to notice/find/fix. My preference would be to use Thread::Queue, which will do all that for you, and probably simplify your main loop considerably. (The sample code, again).

           "How many times do I have to tell you again and again .. not to be repetitive?"