lkml.org 
[lkml]   [2013]   [Jun]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: Strange intermittent EIO error when writing to stdout since v3.8.0
    On 2013.06.06 at 18:31 +0100, David Howells wrote:
    > Markus Trippelsdorf <markus@trippelsdorf.de> wrote:
    >
    > > OSError: [Errno 5] Input/output error
    > >
    > > Basically 'emerge' just writes the build output to stdout in a loop:
    >
    > I've just upgraded to kernel-3.9.4-200.fc18.x86_64 and I'm now regularly
    > seeing something very similar from the tee run by "fedpkg local" to log its
    > output when building a cross-compiler gcc RPM:
    >
    > tee: standard output: Input/output error
    > tee: write error
    >
    > Slapping strace on tee after the "Input/output error" line has occurred shows
    > that tee is still running and still pushing lines from its stdin to the output
    > named on its command line, but has ceased writing to its stdout.

    tee uses the same loop as portage, but keeps going in case of an EIO:

    /* In the array of NFILES + 1 descriptors, make
    the first one correspond to standard output. */
    descriptors[0] = stdout;
    files[0] = _("standard output");
    setvbuf (stdout, NULL, _IONBF, 0);

    for (i = 1; i <= nfiles; i++)
    {
    descriptors[i] = (STREQ (files[i], "-")
    ? stdout
    : fopen (files[i], mode_string));
    if (descriptors[i] == NULL)
    {
    error (0, errno, "%s", files[i]);
    ok = false;
    }
    else
    setvbuf (descriptors[i], NULL, _IONBF, 0);
    }

    while (1)
    {
    bytes_read = read (0, buffer, sizeof buffer);
    if (bytes_read < 0 && errno == EINTR)
    continue;
    if (bytes_read <= 0)
    break;

    /* Write to all NFILES + 1 descriptors.
    Standard output is the first one. */
    for (i = 0; i <= nfiles; i++)
    if (descriptors[i]
    && fwrite (buffer, bytes_read, 1, descriptors[i]) != 1)
    {
    error (0, errno, "%s", files[i]);
    descriptors[i] = NULL;
    ok = false;
    }
    }

    --
    Markus


    \
     
     \ /
      Last update: 2013-06-06 21:21    [W:4.534 / U:1.316 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site