delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/03/07/05:40:23

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Mon, 7 Mar 2011 11:39:51 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Cc: Robert Wruck <wruck AT tweerlei DOT de>
Subject: Re: 1.7.8: write fails with EAGAIN
Message-ID: <20110307103951.GL6393@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com, Robert Wruck <wruck AT tweerlei DOT de>
References: <4D72992D DOT 4090007 AT tweerlei DOT de>
MIME-Version: 1.0
In-Reply-To: <4D72992D.4090007@tweerlei.de>
User-Agent: Mutt/1.5.21 (2010-09-15)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Mar  5 21:12, Robert Wruck wrote:
> Hi,
> 
> recently, I found that cygwin-git was not able to 'cat-file' files
> that exceeded some size (in my case about 80MB).
> I tracked this down to the cygwin implementation of write() that
> behaves quite odd in some cases.
> 
> I wrote a small program (source attached) that mmaps a given file
> and tries to write it to another file or stdout.
> 
> The results vary:
> 
> If the destination is a file (`writetest infile outfile` or
> `writetest infile > outfile`), the write succeeds in a single call.
> 
> If the destination is a pipe (`writetest infile | cat > outfile`),
> the write succeeds in most cases. BUT:
> 
> Under WinXP (XP Service Pack 2, 32bit), the call returns -1 and
> errno=EAGAIN. Nevertheless, SOME data is written to the pipe (in my
> case 4096 byte for each call).
> This breaks git since it does an infinite loop while errno=EAGAIN.

Hang on, you are saying that a *blocking* write(2) to a pipe returns
with EAGAIN?  Are you sure?  It would be quite a surprise if git would
actually do that.  EAGAIN is only an expected error for non-blocking
I/O, so applications which use blocking I/O usually only test for EINTR.

Where you able to reproduce the issue with the testcase you attached to
your mail?  If so, you forgot to add a hint how to use it and an example
of the expected outcome.  That would be quite helpful.

> Any ideas where to investigate further? EAGAIN is set for example in
> fhandler.cc, fhandler_base_overlapped::has_ongoing_io but I don't
> know whether that function is involved in my case.

It is.  The overlapped io stuff is only used for pipes and fifos right
now.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019