All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Randall S. Becker" <rsbecker@nexbridge.com>
To: "'Torsten Bögershausen'" <tboegi@web.de>,
	"'Joachim Schmitz'" <jojo@schmitz-digital.de>,
	git@vger.kernel.org
Subject: RE: read()  MAX_IO_SIZE bytes, more than SSIZE_MAX?
Date: Sat, 7 Feb 2015 13:20:20 -0500	[thread overview]
Message-ID: <01f501d04302$bb9a46b0$32ced410$@nexbridge.com> (raw)
In-Reply-To: <01f201d04300$cce22ca0$66a685e0$@nexbridge.com>

On 2015-02-07 13:07PM Randall S. Becker wrote:
>On 2015-02-07 12:30PM Torsten Bögershausen wrote:
>>On 2015-02-07 17.45, Joachim Schmitz wrote:
>>> Hi there
>>> 
>>> While investigating the problem with hung git-upload-pack we think to 
>>> have found a bug in wrapper.c:
>>> 
>>> #define MAX_IO_SIZE (8*1024*1024)
>>> 
>>> This is then used in xread() to split read()s into suitable chunks.
>>> So far so good, but read() is only guaranteed to read as much as 
>>> SSIZE_MAX bytes at a time. And on our platform that is way lower than 
>>> those 8MB (only 52kB, POSIX allows it to be as small as 32k), and as a 
>>> (rather strange) consequence mmap() (from compat/mmap.c) fails with 
>>> EACCESS (why EACCESS?), because xpread() returns something > 0.
>>> 
>>> How large is SSIZE_MAX on other platforms? What happens there if you 
>>> try to
>>> read() more? Should't we rather use SSIZE_MAX on all platforms? If I'm 
>>> reading the header files right, on Linux it is LONG_MAX (2TB?), so I 
>>> guess we should really go for MIN(8*1024*1024,SSIZE_MAX)?
>>How about changing wrapper.c like this: 
>>#ifndef MAX_IO_SIZE
>> #define MAX_IO_SIZE (8*1024*1024)
>>#endif
>>---------------------

Although I do agree with Jojo, that MAX_IO_SIZE seems to be a platform
constant and should be defined in terms of SSIZE_MAX. So something like:

#ifndef MAX_IO_SIZE
# ifdef SSIZE_MAX
#  define MAX_IO_SIZE (SSIZE_MAX)
# else
#  define MAX_IO_SIZE (8*1024*1024)
# endif
#endif

would be desirable.

Cheers, Randall

  reply	other threads:[~2015-02-07 18:26 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-07 16:45 read() MAX_IO_SIZE bytes, more than SSIZE_MAX? Joachim Schmitz
2015-02-07 16:48 ` Joachim Schmitz
2015-02-07 17:19 ` Torsten Bögershausen
2015-02-07 17:29   ` Joachim Schmitz
2015-02-07 18:03     ` Joachim Schmitz
2015-02-07 20:32     ` Torsten Bögershausen
2015-02-07 22:13       ` Junio C Hamano
2015-02-07 22:31         ` Joachim Schmitz
2015-02-08  2:13           ` Junio C Hamano
2015-02-08  2:32             ` Randall S. Becker
2015-02-08 12:05             ` Joachim Schmitz
2015-02-08 17:09               ` Eric Sunshine
2015-02-11 21:13                 ` Junio C Hamano
2015-02-11 21:29                   ` Joachim Schmitz
2015-02-11 22:05                     ` Joachim Schmitz
2015-02-11 23:15                       ` Junio C Hamano
2015-02-07 18:06   ` Randall S. Becker
2015-02-07 18:20     ` Randall S. Becker [this message]
2015-02-07 18:36       ` Joachim Schmitz
2015-02-07 19:14 ` Joachim Schmitz
  -- strict thread matches above, loose matches on Subject: below --
2015-02-12  7:46 Joachim Schmitz

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='01f501d04302$bb9a46b0$32ced410$@nexbridge.com' \
    --to=rsbecker@nexbridge.com \
    --cc=git@vger.kernel.org \
    --cc=jojo@schmitz-digital.de \
    --cc=tboegi@web.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.