Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Net::OpenSSH - page not loading completely

by Eliya (Vicar)
on Apr 16, 2012 at 09:51 UTC ( #965267=note: print w/ replies, xml ) Need Help??


in reply to Net::OpenSSH - page not loading completely

You might want to use lsof to figure out what open file handle is keeping the respective webserver process from considering the CGI call done.  Apache, for example, would wait for all stdout/stderr handles (i.e. of the CGI itself and any children the CGI forked) to be closed.

You probably also need to point default_stderr_fh to /dev/null (or simply set master_stdout_discard => 1, master_stderr_discard => 1), but that's just a guess (i.e. untested).


Comment on Re: Net::OpenSSH - page not loading completely
Select or Download Code
Re^2: Net::OpenSSH - page not loading completely
by comanche008 (Initiate) on Apr 16, 2012 at 11:46 UTC
    Tried this but did not work.
    my %opts = ( user => 'root', batch_mode => 1, key_path => '~/.ssh/id_rsa', #passwd => '', ssh_cmd => '/usr/bin/ssh', default_stdin_fh => $def_in, #default_stdout_fh => $def_out, master_stdout_discard => 1, master_stderr_discard => 1, kill_ssh_on_timeout => 1, timeout => 5 );
    I haven't found the file handle in question. Will need to read further how to track it. Thanks.

      Just tried it (on Ubuntu, apache 2.2.20), and it worked fine for me, even without fiddling with the default_* / master_* options.   I.e., the ssh master connection etc. is automatically being terminated properly.

      Maybe enabling debugging

      $Net::OpenSSH::debug |= 0x7f;

      will shed some light on what isn't working in your case (output ends up in the webserver's error log).

        Thanks for the suggestions. The error "Pseudo-terminal will not be allocated because stdin is not a terminal." seems to be common. Below is the relevant part of the error log. The problem occurs frequently but not every single time the page is loaded.
        # open_ex: ['/usr/bin/ssh','-S','/var/lib/wwwrun/.libnet-openssh-perl/ +root-192.168.100.8-20273-555951','-l','root','192.168.100.8','--'] Pseudo-terminal will not be allocated because stdin is not a terminal. # _waitpid(20296) => pid: 20296, rc: # open_ex: ['/usr/bin/ssh','-O','check','-T','-S','/var/lib/wwwrun/.li +bnet-openssh-perl/root-192.168.100.8-20273-373748','-l','root','192.1 +68.100.8','--'] # waiting for slave, timeout: 5, remaining: 5, sleep: 1 # _waitpid(20299) => pid: 20299, rc: Interrupted system call # open_ex: ['/usr/bin/ssh','-S','/var/lib/wwwrun/.libnet-openssh-perl/ +root-192.168.100.8-20273-373748','-l','root','192.168.100.8','--'] Pseudo-terminal will not be allocated because stdin is not a terminal. # _waitpid(20300) => pid: 20300, rc: # open_ex: ['/usr/bin/ssh','-O','exit','-T','-S','/var/lib/wwwrun/.lib +net-openssh-perl/root-192.168.100.8-20273-373748','-l','root','192.16 +8.100.8','--'] # waiting for slave, timeout: 5, remaining: 5, sleep: 1 # _waitpid(20301) => pid: 20301, rc: Interrupted system call # open_ex: ['/usr/bin/ssh','-O','exit','-T','-S','/var/lib/wwwrun/.lib +net-openssh-perl/root-192.168.100.8-20273-555951','-l','root','192.16 +8.100.8','--'] # waiting for slave, timeout: 5, remaining: 5, sleep: 1 # _waitpid(20302) => pid: 20302, rc: Interrupted system call

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (13)
As of 2014-07-25 18:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (174 votes), past polls