I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2008-01-31 22:33:06-08 by oliver in response to 6909
Re: Can't use Net::Appliance::Session inside a thread
Hi Miky,

I don't have a lot of experience with threads, but I did run your sample program (thanks for that!) and made a little investigation.

My best guess is that this is a problem with the Net::Telnet module. My reason for reaching this conclusion is that the error message returned, "Failed to get first prompt", is returned *immediately* after the connect() method is called. There should be a 10 second timeout on this, waiting for the prompt. The timeout actually happens within the waitfor() method of Net::Telnet, so I think it's this which is not thread safe. For some reason it does not wait 10 seconds but instead returns immediately with a failure. Perhaps it is some problem with signal handling?

Unfortunately, the loop which has the "broken" timeout in Net::Telnet is generated code, so it's hard to debug, and also because I am not an experienced threads programmer I wouldn't know where to start anyway.

For now, I think we are going to have to say that Net::Appliance::Session is not thread safe, because of this problem. I'm very sorry about that.

regards,
oliver.
Direct Responses: 6986 | Write a response