git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Yaroslav Halchenko <yoh@onerussian.com>
To: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: fatal: Out of memory, getdelim failed under NFS mounts
Date: Thu, 10 Aug 2017 15:44:38 -0400	[thread overview]
Message-ID: <20170810194438.n6cmljlorind2enu@hopa.kiewit.dartmouth.edu> (raw)
In-Reply-To: <xmqqzib72qvs.fsf@gitster.mtv.corp.google.com>

Thank you Junio

On Thu, 10 Aug 2017, Junio C Hamano wrote:
> There is only one getdelim() call, which was introduced in v2.5.0
> timeframe, and it is used like this:

> 	r = getdelim(&sb->buf, &sb->alloc, term, fp);

> 	if (r > 0) {
> 		sb->len = r;
> 		return 0;
> 	}
> 	assert(r == -1);

> 	/*
> 	 * Normally we would have called xrealloc, which will try to free
> 	 * memory and recover. But we have no way to tell getdelim() to do so.
> 	 * Worse, we cannot try to recover ENOMEM ourselves, because we have
> 	 * no idea how many bytes were read by getdelim.
> 	 *
> 	 * Dying here is reasonable. It mirrors what xrealloc would do on
> 	 * catastrophic memory failure. We skip the opportunity to free pack
> 	 * memory and retry, but that's unlikely to help for a malloc small
> 	 * enough to hold a single line of input, anyway.
> 	 */
> 	if (errno == ENOMEM)
> 		die("Out of memory, getdelim failed");

> So the function is returning -1 and leaving ENOMEM in errno on
> Yaroslav's system.  

> I wonder if we are truly hitting out of memory, though.  The same
> symptom could bee seen if getdelim() does not touch errno when it
> returns -1, but some other system call earlier set it to ENOMEM,
> for example.

> If the same version of Git is recompiled there without HAVE_GETDELIM
> defined, would it still die with out of memory (presumably inside
> the call to strbuf_grow() in the strbuf_getwholeline() function)?

will check now...  for my own education (rotten by Python) -- how
do you know which syscall set errno to be analyzed at this specific
point?  may be it was already set to ENOMEM before entry to this
function?

-- 
Yaroslav O. Halchenko
Center for Open Neuroscience     http://centerforopenneuroscience.org
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
Phone: +1 (603) 646-9834                       Fax: +1 (603) 646-1419
WWW:   http://www.linkedin.com/in/yarik        

  reply	other threads:[~2017-08-10 19:44 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-09 17:39 fatal: Out of memory, getdelim failed under NFS mounts Yaroslav Halchenko
2017-08-10 13:27 ` René Scharfe
2017-08-10 14:43   ` Yaroslav Halchenko
2017-08-10 19:44     ` René Scharfe
2017-08-10 18:56   ` Junio C Hamano
2017-08-10 19:44     ` Yaroslav Halchenko [this message]
2017-08-10 19:58     ` René Scharfe
2017-08-10 20:05       ` Jeff King
2017-08-10 20:29         ` Yaroslav Halchenko
2017-08-10 20:56         ` [PATCH] strbuf: clear errno before calling getdelim(3) René Scharfe
2017-08-10 21:02           ` Jeff King
2017-08-10 21:35             ` Yaroslav Halchenko
2017-08-10 21:41           ` Junio C Hamano
2017-08-11  7:50           ` Simon Ruderich
2017-08-11  8:52             ` René Scharfe
2017-08-12 10:02               ` Simon Ruderich
2017-08-12 11:57                 ` René Scharfe
2017-08-12 12:21                   ` René Scharfe
2017-08-13  4:32                   ` Jeff King
2017-08-13  5:51                     ` René Scharfe
2017-08-13  5:58                       ` Jeff King

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170810194438.n6cmljlorind2enu@hopa.kiewit.dartmouth.edu \
    --to=yoh@onerussian.com \
    --cc=git@vger.kernel.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).