expect - broken pipe

Jon Beniston jon@beniston.com
Wed Jan 20 12:57:00 GMT 2016


Hi,

I'm trying to run the GCC DejaGNU testsuite on 32-bit Cygwin. It randomly
fails with the message:

"parent: sync byte write: broken pipe"

This occurs frequently if the testsuite is run in parallel (i.e. make -j4),
but occasionally when not in parallel too.

It seems this error message is generated by the 'expect' program,
specifically from exp_command.c. This does roughly the following:

pipe(sync_fds);
pipe(sync2_fds);
.
pid = fork();
if (pid) { /* parent */
    close(sync_fds[1]);
    close(sync2_fds[0]);

    /* wait for slave to initialize */
    while (((rc = read(sync_fds[0],&sync_byte,1)) < 0) && (errno == EINTR))
{
        /* empty */;
    }
   ...
   /* tell slave to go on */
    wc = write(sync2_fds[1]," ",1);
    if (wc == -1) {
       expErrorLog("parent: sync byte write: %s\r\n",Tcl_ErrnoMsg(errno));
    }

So, the write to the pipe is failing randomly with errno==EPIPE. Any idea
why this might be?

What is strange, is if I remove the call to close(sync2_fds[0]), then the
write never fails. Closing the unused end of the pipe seems fairly standard
behaviour as that is what is given as an example in the pipe() man page.

Cheers,
Jon


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list