Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: threads and Net::OpenSSH

by rastoboy (Monk)
on Mar 16, 2012 at 14:27 UTC ( [id://959983]=note: print w/replies, xml ) Need Help??


in reply to Re: threads and Net::OpenSSH
in thread threads and Net::OpenSSH

BrowserUK: lol neither am I :-)

I guess the main thing I don't understand is why my "tail -f" sessions die when I join those threads. My understanding of join() is that it tells the program to wait for the thread to finish. But a tail -f by itself would never finish, right?

Replies are listed 'Best First'.
Re^3: threads and Net::OpenSSH (Ask [salva] :)
by BrowserUk (Patriarch) on Mar 16, 2012 at 14:57 UTC

    A quick look at the POD suggests that Net::OpenSSH implements timeouts that will close connections after a lack of network activity.

    A grep inside turns up this calculation which suggests that the default timeout is 90 (or 30?) seconds:

    my $timeout = int((($self->{_timeout} || 90) + 2)/3);

    My guess is that if the remote system is idle, tail -f syslog will produce no output and so the module closes the connection. Maybe you should consider using an explicit timeout.


    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.

    The start of some sanity?

Re^3: threads and Net::OpenSSH
by rastoboy (Monk) on Mar 16, 2012 at 14:30 UTC
    Hmm, actually I'm seeing in some cases that it merely detaches those tail -f threads. What would be the best way to actually terminate those tail -f threads when I'm ready? There seem to be a lot of options.
      I'm seeing in some cases that it merely detaches those tail -f threads.

      Hm What "it"?

      Threads do not detach unless explicitly detached. join() will block until the thread terminates.

      Unless you've changed your code, what you're suggesting isn't possible.


      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.

      The start of some sanity?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://959983]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (2)
As of 2024-04-25 06:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found