X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY X-Spam-Check-By: sourceware.org X-Yahoo-SMTP: jenXL62swBAWhMTL3wnej93oaS0ClBQOAKs8jbEbx_o- Date: Wed, 9 Mar 2011 16:29:30 -0500 From: Christopher Faylor To: cygwin AT cygwin DOT com Subject: Re: 1.7.8: write fails with EAGAIN Message-ID: <20110309212930.GA21668@ednor.casa.cgf.cx> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <4D72992D DOT 4090007 AT tweerlei DOT de> <20110307103951 DOT GL6393 AT calimero DOT vinschen DOT de> <4D77C5CB DOT 1040909 AT tweerlei DOT de> <4D77C9C8 DOT 2000802 AT cygwin DOT com> <4D77CCC4 DOT 3070406 AT tweerlei DOT de> <4D77CF7F DOT 7090009 AT tweerlei DOT de> <4D77D923 DOT 1090508 AT tweerlei DOT de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4D77D923.1090508@tweerlei.de> User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , 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 Wed, Mar 09, 2011 at 08:46:43PM +0100, Robert Wruck wrote: >>> I replaced the cygwin1.dll with cygwin1-20110309.dll and now a single >>> write() with 78 MB never returns but seems to write repeatedly to the >>> pipe (file was 5GB when I hit Ctrl-C). > >Just terminating the loop after write_overlapped_fallback is not enough. >When the size to write exceeds MAX_OVERLAPPED_WRITE_LEN and WriteFile >fails for MAX_OVERLAPPED_WRITE_LEN, write() will always return 0. > >In case of overlapped_error, nbytes should be set to -1. In theory that's a situation that the caller would never see but I will fix that. >I'd suggest to remove write_overlapped_fallback and instead decrement >'len' on each failure. Since write is not guaranteed to write the whole >data, this should be OK. The goal is to emulate what Linux does. Linux succeeds when writing huge blocks to a non-blocking pipe. Since the code is already there (modulo the bugs that you've noted) to do the same thing with Cygwin I'm not going to back out what I've done and reduce the functionality. I'm going to fix the bugs. cgf -- 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