in reply to Re: Expect and PTY dropping data
in thread Expect and PTY dropping data

At the Perl level, syswrite reports that all the data has been written. At the OS level, a process monitoring tool such as truss shows the write call also reporting that all the data has been written.

And BTW, the dropped data is not the chunk tail but the head!

update: this is the interaction between both processes at the OS level:

27168: write(4, "\0\0\00501\0\0\003", 9) = 9 27170: read(7, "\0\0\00501\0\0\003", 16384) = 9 27170: write(8, "\0\0\00502\0\0\003", 9) = 9 27168: read(4, "\0\0\00502\0\0\003", 16384) = 9 27168: write(4, "\0\0\0" 03\0\0\0\0\0\0\0\r/ t m ".., 38) = 38 27170: read(7, "\0\0\0" 03\0\0\0\0\0\0\0\r/ t m ".., 16384) = 38 27170: write(8, "\0\0\0\rf \0\0\0\0\0\0\004\0\0\0".., 17) = 17 27168: read(4, "\0\0\0\rf \0\0\0\0\0\0\004\0\0\0".., 16384) = 17 27168: write(4, "\0\0\015\n\0\0\001\0\0\004\0\0\0".., 25) = 25 27170: read(7, "\0\0\015\n\0\0\001\0\0\004\0\0\0".., 16384) = 25 27170: write(8, "\0\0\018e \0\0\001\0\0\0\0\0\0\0".., 28) = 28 27168: read(4, "\0\0\018e \0\0\001\0\0\0\0\0\0\0".., 16384) = 28 27168: write(4, "\0\0@ 1906\0\0\002\0\0\004\0\0\0".., 16413) = 16413 27170: read(7, "a l / l i b \nL I B C = \nL ".., 16384) = 1024
Note how reads and writes for both processes interleave until the last one where only 1024 bytes are read by the child and that those bytes do not correspond to the head of the last write operation performed on the parent!

Replies are listed 'Best First'.
Re^3: Expect and PTY dropping data
by moritz (Cardinal) on May 21, 2008 at 15:02 UTC
    This sounds like an operating system bug.

    If it is indeed, you shouldn't even think about fixing it on the perl level. Write a bug report against the OS instead.