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).


In reply to Re^2: Using Net::SSH2 with Net::Telnet::Cisco by Anonymous Monk
in thread Using Net::SSH2 with Net::Telnet::Cisco by ryber

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.