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

Re: pread() over NFS (again) [1.5.5.4]

From
Shawn O. Pearce <spearce@spearce.org>
Date
Jun 26, 2008, 20:46 UTC
Message-ID
<20080626204606.GX11793@spearce.org>
In-Reply-To
<6F25C1B4-85DE-4559-9471-BCD453FEB174@gmail.com>
Christian Holtje <docwhat@gmail.com> wrote:
> I have read all the threads on git having trouble with pread() and I  
> didn't see anything to help.
...
Show 7 quoted lines
>   Receiving objects: 100% (253/253), 5.27 MiB | 9136 KiB/s, done.
>   fatal: cannot pread pack file: No such file or directory
>   fatal: index-pack failed
> 
> The end of the strace looks like so:
> pread(3, "", 205, 1373)                 = 0
> write(2, "fatal: cannot pread pack file: N"..., 57) = 57

Hmmph. So pread for a length of 205 can return 0 on NFS? Is this a transient error? If so, perhaps a patch like this might help:

diff --git a/index-pack.c b/index-pack.c
index 5ac91ba..737f757 100644
--- a/index-pack.c
+++ b/index-pack.c
@@ -309,14 +309,19 @@ static void *get_data_from_pack(struct object_entry *obj)
 	unsigned char *src, *data;
 	z_stream stream;
 	int st;
+	int attempts = 0;
 
 	src = xmalloc(len);
 	data = src;
 	do {
 		ssize_t n = pread(pack_fd, data + rdy, len - rdy, from + rdy);
-		if (n <= 0)
+		if (n <= 0) {
+			if (n == 0 && ++attempts < 10)
+				continue;
 			die("cannot pread pack file: %s", strerror(errno));
+		}
 		rdy += n;
+		attempts = 0;
 	} while (rdy < len);
 	data = xmalloc(obj->size);
 	memset(&stream, 0, sizeof(stream));


The file shouldn't be short unless someone truncated it, or there
is a bug in index-pack.  Neither is very likely, but I don't think
we would want to retry pread'ing the same block forever.
-- 
Shawn.
Previous: Christian HoltjeNext: Junio C Hamano
Message 2 of 16 in “pread() over NFS (again) [1.5.5.4]”
  1. Christian HoltjeJun 26, 2008
  2. Shawn O. PearceJun 26, 2008
  3. Junio C HamanoJun 26, 2008
  4. Shawn O. PearceJun 26, 2008
  5. Christian HoltjeJun 26, 2008
  6. Junio C HamanoJun 26, 2008
  7. Shawn O. PearceJun 26, 2008
  8. logank@sent.comJun 26, 2008
  9. Junio C HamanoJun 26, 2008
  10. J. Bruce FieldsJun 27, 2008
  11. Trond MyklebustJun 27, 2008
  12. Shawn O. PearceJun 30, 2008
  13. Nicolas PitreJun 30, 2008
  14. J. Bruce FieldsJun 27, 2008
  15. Christian HoltjeJun 27, 2008
  16. Christian HoltjeJun 27, 2008

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.