public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Markus Trippelsdorf <markus@trippelsdorf.de>
To: David Howells <dhowells@redhat.com>
Cc: linux-kernel@vger.kernel.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jslaby@suse.cz>
Subject: Re: Strange intermittent EIO error when writing to stdout since v3.8.0
Date: Thu, 6 Jun 2013 20:41:29 +0200	[thread overview]
Message-ID: <20130606184129.GA6854@x4> (raw)
In-Reply-To: <12790.1370539861@warthog.procyon.org.uk>

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

  reply	other threads:[~2013-06-06 18:41 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-06 11:54 Strange intermittent EIO error when writing to stdout since v3.8.0 Markus Trippelsdorf
2013-06-06 14:18 ` Peter Hurley
2013-06-06 14:37   ` Markus Trippelsdorf
2013-06-07 15:39     ` Peter Hurley
2013-06-07 16:07       ` Markus Trippelsdorf
2013-06-07 18:22       ` Mikael Pettersson
2013-06-13 10:39         ` Markus Trippelsdorf
2013-06-13 14:16           ` Peter Hurley
2013-06-13 14:51             ` Markus Trippelsdorf
2013-06-13 15:25               ` [PATCH] tty: Debug EIO from write() Peter Hurley
2013-06-13 16:16                 ` Markus Trippelsdorf
2013-06-13 16:29                   ` Peter Hurley
2013-06-13 19:56                     ` [PATCH] tty: Fix transient pty write() EIO Peter Hurley
2013-06-16 17:31                       ` Mikael Pettersson
2013-06-07 19:56       ` Strange intermittent EIO error when writing to stdout since v3.8.0 David Howells
2013-06-11 22:14       ` Orion Poplawski
2013-06-13 10:38         ` Markus Trippelsdorf
2013-06-06 14:41 ` Mikael Pettersson
2013-06-06 17:31 ` David Howells
2013-06-06 18:41   ` Markus Trippelsdorf [this message]
2013-06-08 18:56 ` Rob Landley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130606184129.GA6854@x4 \
    --to=markus@trippelsdorf.de \
    --cc=dhowells@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox