apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Orton <jor...@redhat.com>
Subject Re: [PATCH] Fix for Subversion issue #1789
Date Mon, 19 Feb 2007 09:33:15 GMT
On Mon, Feb 19, 2007 at 12:30:00AM -0600, Jonathan Gilbert wrote:
> Windows has a bug in its WriteFile API. When the file handle is a console
> output handle and the data chunk is greater than some value around 60 KB,
> instead of doing either a complete write (which would be ideal) or a
> partial write (which is permitted by the API contract), it returns an
> incorrect error causing Subversion to display an error message such as:
> 
> svn: Can't write to stream: Not enough storage is available to process this
> command.
> 
> Clearly, as the actual bug is in Windows, we can't fix the bug itself, so
> we need a work-around, and common sense dictates that that work-around be
> as close as possible to the API. So, the patch is for APR.
> 
> The obvious work-around is to take large writes and divide them up into
> smaller writes

When not just constrain the length to 32K (doing so iff the file is a 
console output handle, if that's cheap to handle).

  if (*nbytes > MAX_VALUE) *nbytes = MAX_VALUE;

and just do a partial write; as you say, the API allows this.

joe

Mime
View raw message