Git development
 help / color / mirror / Atom feed
From: "Björn Steinbrink" <B.Steinbrink@gmx.de>
To: Avery Pennarun <apenwarr@gmail.com>
Cc: git@vger.kernel.org, Eric Wong <normalperson@yhbt.net>,
	Adam Roben <aroben@apple.com>, Samuel Bronson <naesten@gmail.com>,
	gitster@pobox.com
Subject: Re: [PATCH v2] git-svn: avoid filling up the disk with temp files.
Date: Sun, 29 Jun 2008 02:58:58 +0200	[thread overview]
Message-ID: <20080629005858.GA2036@atjola.homenet> (raw)
In-Reply-To: <1214696036-8294-1-git-send-email-apenwarr@gmail.com>

On 2008.06.28 19:33:56 -0400, Avery Pennarun wrote:
> Commit ffe256f9bac8a40ff751a9341a5869d98f72c285 ("git-svn: Speed up fetch")
> introduced changes that create a temporary file for each object fetched by
> svn.  These files should be deleted automatically, but perl apparently
> doesn't do this until the process exits (or perhaps when its garbage
> collector runs).
> 
> This means that on a large fetch, especially with lots of branches, we
> sometimes fill up /tmp completely, which prevents the next temp file from
> being written completely.  This is aggravated by the fact that a new temp
> file is created for each updated file, even if that update produces a file
> identical to one already in git.  Thus, it can happen even if there's lots
> of disk space to store the finished repository.
> 
> We weren't adequately checking for write errors, so this would result in an
> invalid file getting committed, which caused git-svn to fail later with an
> invalid checksum.
> 
> This patch adds a check to syswrite() so similar problems don't lead to
> corruption in the future.  It also unlink()'s each temp file explicitly
> when we're done with it, so the disk doesn't need to fill up.

Oh sweet! That also means that I don't have to fear about the repos I
already track with git-svn being corrupted (at least I hope so). :-)

And yeah, looking at /tmp, there are still 58K temp files belonging to
the failed import. Temporarily mounting a 8k tmpfs there triggers the
bug immediately, while with this patch I get a error message.

I'm running another import of the coq repo that failed earlier, just to
make sure, but I also just noticed that cat-file --batch is leaking
memory. For example this one shoots up to about 700M RSS usage with
git.git:

git rev-list --objects origin/master | \
	sed 's/ .*//' | \
	git cat-file --batch > /dev/null

I'll follow-up with a patch that at least fixes the worst part of that,
getting the RSS usage for the above test down to about 40M.

Thanks!
Björn

  reply	other threads:[~2008-06-29  1:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-28 19:48 git-svn messed up import, badly Björn Steinbrink
2008-06-28 20:57 ` [PATCH] Revert "git-svn: Speed up fetch" Avery Pennarun
2008-06-28 23:33   ` [PATCH v2] git-svn: avoid filling up the disk with temp files Avery Pennarun
2008-06-29  0:58     ` Björn Steinbrink [this message]
2008-06-29  1:21       ` [PATCH] git cat-file: Fix memory leak in batch mode Björn Steinbrink
2008-06-29  3:36         ` Junio C Hamano
2008-06-29 11:54           ` Björn Steinbrink
2008-06-29  2:24       ` [PATCH v2] git-svn: avoid filling up the disk with temp files Björn Steinbrink
2008-06-29  2:38     ` Eric Wong
2008-06-28 23:51   ` [PATCH] Revert "git-svn: Speed up fetch" Mikael Magnusson
2008-06-28 23:58     ` Avery Pennarun

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=20080629005858.GA2036@atjola.homenet \
    --to=b.steinbrink@gmx.de \
    --cc=apenwarr@gmail.com \
    --cc=aroben@apple.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=naesten@gmail.com \
    --cc=normalperson@yhbt.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox