in reply to Re: Using Net::SSH2 with Net::Telnet::Cisco
in thread Using Net::SSH2 with Net::Telnet::Cisco
Thanks for the response, Tilly. I actually just rewrote this app to use threads instead of fork, which was used in the previous version. I was able to get much greater concurrency with threads than I did with fork() and decreased the run time substantially. So, I really don't want to have to rewrite it again to use fork().
With both Net::Appliance::Session and Net::SSH::Perl, I have the "use" statement in the subroutine that is called by the thread. In each case, I wrote a very simple program. The first version does not create any threads and just calls the subroutine- that works without an issue. Then I modify it so that the subroutine is called as one or more threads. The threaded versions fail consistently.
I will post the sample programs with more details tomorrow (when I am on my work machine), but basically the Net::Appliance::Session version fails when Net::Appliance::Session::Transport::SSH forks and runs ssh and then tries to create a new IO::Pty object attached to it (I have since read the IO:Pty is not thread safe). The Net::SSH::Perl version will just crash with a Memory Fault at some point in its execution (I have since read that Math::PARI is not thread safe).
I thought about trying what you are suggesting, where a separate process is invoked from the threads, but if I do that I may as well just rewrite to use fork().
Thanks again for your comments (and any more you might have).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Using Net::SSH2 with Net::Telnet::Cisco
by Argel (Prior) on Jan 15, 2011 at 00:21 UTC | |
by ryber (Acolyte) on Jan 18, 2011 at 18:12 UTC | |
by Argel (Prior) on Jan 19, 2011 at 02:40 UTC | |
by ryber (Acolyte) on Jan 20, 2011 at 18:12 UTC |