in reply to Re: Script hangs when executing command over ssh
in thread Script hangs when executing command over ssh

Thank you for your reply. Yes perhaps it does have to do with the STDERR buffering, and it seems to be at about 32K. Do I need to increase that buffer somehow?

The actual program I am running is outputting to STDERR (and STDOUT) and I have no control over that output. I just gave the above code as an example of the more complicated one.

  • Comment on Re^2: Script hangs when executing command over ssh

Replies are listed 'Best First'.
Re^3: Script hangs when executing command over ssh
by marinersk (Priest) on Jun 18, 2015 at 17:24 UTC

    If there's a way to work with the buffer, hopefully a more Unix/Linux-oriented Monk will come along with a suggestion. However, I don't think you understood my point about getting rid of the piping.

    Try removing the 1>&2from your command, and see if the problem goes away.

      I understand your point regarding the output redirection. Removing 1>&2 from the command does get rid of the problem in this specific example.

      However the actual program is being run like  $ssh->cmd('/bin/a'); and it writes some output to STDERR, and unfortunately I do not have any control over that. Thank you

        Your answer still leaves me believing you're not getting my point.

        • Yes, the program writes to STDERR.
        • Yes, you cannot control this.
        • We suspect STDERRhas special handling issues.
        • You are messing with STDERRwhen you re-pipe it using 1>&2.
        • Messing with it might be the source of the hang.

        Thus, I'm hoping that removing the 1>&2from your script might prevent the hanging under all cases.

        But it might not. Won't know until you try it against all known cases that currently cause it to hang.