in reply to Re^19: Net::OpenSSH loosing lines ins reply
in thread Net::OpenSSH loosing lines ins reply

Hi Salva,
on a normal run:
============================== start fdinfo 0: pos: 0 flags: 0100002 fdinfo 1: pos: 0 flags: 01 fdinfo 2: pos: 0 flags: 01 ============================== after new fdinfo 0: pos: 0 flags: 0100002 fdinfo 1: pos: 0 flags: 01 fdinfo 2: pos: 0 flags: 01 ============================== after capture fdinfo 0: pos: 0 flags: 0100002 fdinfo 1: pos: 0 flags: 04001 fdinfo 2: pos: 0 flags: 04001


for a failed run:
============================== start fdinfo 0: pos: 0 flags: 0100002 fdinfo 1: pos: 0 flags: 01 fdinfo 2: pos: 0 flags: 01 ============================== after new fdinfo 0: pos: 0 flags: 0100002 fdinfo 1: pos: 0 flags: 01 fdinfo 2: pos: 0 flags: 01 ============================== after capture fdinfo 0: pos: 0 flags: 0100002 fdinfo 1: pos: 0 flags: 04001 fdinfo 2: pos: 0 flags: 04001

so the same....

doesn't mean any thing to me... :-(

I capture output using "tee" or even simpler only using "wc -l".
For really using the script it would be called by another script and stdout would be read by caller.

Replies are listed 'Best First'.
Re^21: Net::OpenSSH loosing lines ins reply
by salva (Canon) on Jun 05, 2014 at 09:57 UTC
    As I had supposed, after the capture call, the O_NONBLOCK flag is set.

    The ssh command that is being run under the hood by capture is leaving STDOUT in non-blocking mode. The issue seems fixed in newer versions of OpenSSH, or at least I am unable to reproduce it with the latest one (6.6.1p1).

    In any case it is easy to workaround. Just using capture2 instead of capture or setting stderr_discard => 1 should make it go.

    BTW, there isn't any difference on the fdinfo dumps between the successfully and failed invocations because the problem is hidden behind a race condition. The perl process needs to be faster writing than tee reading for the intermediate pipe buffer to fill.

      Hi Salva,

      GREAT


      changed to capture2 and problem did not reoccur up to now...

      Follwing your explanations - it shall be solved now!

      hero of my day!

      no chance for me digging that out....