git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* read()  MAX_IO_SIZE bytes, more than SSIZE_MAX?
@ 2015-02-07 16:45 Joachim Schmitz
  2015-02-07 16:48 ` Joachim Schmitz
                   ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Joachim Schmitz @ 2015-02-07 16:45 UTC (permalink / raw)
  To: git

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


bye, Jojo

^ permalink raw reply	[flat|nested] 21+ messages in thread
* Re: read() MAX_IO_SIZE bytes, more than SSIZE_MAX?
@ 2015-02-12  7:46 Joachim Schmitz
  0 siblings, 0 replies; 21+ messages in thread
From: Joachim Schmitz @ 2015-02-12  7:46 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git


Sorry to be a pain, but i think this sententence neede mending

+ * to override this, if the definition of SSIZE_MAX platform is broken.

Bye, Jojo

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2015-02-12  7:46 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).