git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: read() MAX_IO_SIZE bytes, more than SSIZE_MAX?

From
Torsten Bögershausen <tboegi@web.de>
Date
Feb 7, 2015, 17:19 UTC
Message-ID
<54D64939.4080102@web.de>
In-Reply-To
<loom.20150207T174514-727@post.gmane.org>
On 2015-02-07 17.45, Joachim Schmitz wrote:
Show 18 quoted lines
> 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
---------------------
and to change config.mak.uname like this:
ifeq ($(uname_S),NONSTOP_KERNEL)
	BASIC_CFLAGS += -DMAX_IO_SIZE=(32*1024)
Does this work for you ?
Previous: Joachim SchmitzNext: Joachim Schmitz
Message 3 of 20 in “read() MAX_IO_SIZE bytes, more than SSIZE_MAX?”
  1. Joachim SchmitzFeb 7, 2015
  2. Joachim SchmitzFeb 7, 2015
  3. Torsten BögershausenFeb 7, 2015
  4. Joachim SchmitzFeb 7, 2015
  5. Joachim SchmitzFeb 7, 2015
  6. Torsten BögershausenFeb 7, 2015
  7. Junio C HamanoFeb 7, 2015
  8. Joachim SchmitzFeb 7, 2015
  9. Junio C HamanoFeb 8, 2015
  10. Randall S. BeckerFeb 8, 2015
  11. Joachim SchmitzFeb 8, 2015
  12. Eric SunshineFeb 8, 2015
  13. Junio C HamanoFeb 11, 2015
  14. Joachim SchmitzFeb 11, 2015
  15. Joachim SchmitzFeb 11, 2015
  16. Junio C HamanoFeb 11, 2015
  17. Randall S. BeckerFeb 7, 2015
  18. Randall S. BeckerFeb 7, 2015
  19. Joachim SchmitzFeb 7, 2015
  20. Joachim SchmitzFeb 7, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.