in reply to Re^3: SSH2 - Asynchronous Opens & Synchronous Commands
in thread SSH2 - Asynchronous Opens & Synchronous Commands

@BrowserUK: Thank you. It is not the conclusion I wanted to prove, but I agree it is something I will have to accept, until such time someone has the resources to determine why Net::SSH2 (or the underlying libssh2 library) is not completely ithread safe. I am glad we can all now finally agree that Net::SSH2 should not be used with Perl threads, unless the entire life of a session resides within a thread (connect, auth, commands, and close). Much appreciated!

Update: I plan to give Salva's suggestion a try, but not until after I finish with my Net::OpenSSH test...
"The trick would be to call $ssh2->blocking(0) just after creating the Net::SSH2 object and then calling connect and auth_* while checking for LIBSSH2_ERROR_EAGAIN errors and then using the select function to wait for data to arrive at some of the underlaying sockets."

  • Comment on Re^4: SSH2 - Asynchronous Opens & Synchronous Commands

Replies are listed 'Best First'.
Re^5: SSH2 - Asynchronous Opens & Synchronous Commands
by BrowserUk (Patriarch) on Apr 05, 2014 at 15:20 UTC

    I just read this on the front page of the libssh2 website:

    Thread-safe: just don't share handles simultaneously

    (S'funny definition of "thread-safe" :( )


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    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.