git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Randall S. Becker" <rsbecker@nexbridge.com>
To: <hv@crypt.org>, <git@vger.kernel.org>
Subject: RE: safer git?
Date: Sat, 24 Oct 2020 18:11:54 -0400	[thread overview]
Message-ID: <016001d6aa52$b1cbc510$15634f30$@nexbridge.com> (raw)
In-Reply-To: <202010242019.09OKJTP13180@crypt.org>

On October 24, 2020 4:19 PM, hv@crypt.org wrote:
> Hi, due to a hardware or firmware issue, my machine is currently crashing
> rather a lot. If that happens around the time I'm performing any git
activity,
> it seems quite likely to cause substantial corruption of the git state.
> 
> I've responded both by running sync(1) every 60 seconds and by pushing
work
> to github more frequently, but the latter isn't appropriate for
everything;
> twice recently I've lost a fair bit of work as a result.
> 
> Q: Is there a mode in which I can run git that would make it a bit more
robust
> against crashes, at the cost of being a bit slower?
> 
> 
> The primary symptom is that files modified shortly before a crash show up
> existing but zero-length after the crash. For source files I mostly know
what
> to do in that situation, but `git fsck` shows a lot of files under
'.git/objects'
> that are empty, which seems to make things hard to recover:
> 
> % git fsck
> error: object file
> .git/objects/0e/f31631726cea2e9bf89d7bbe7b924b5282d533 is empty
> error: unable to mmap
> .git/objects/0e/f31631726cea2e9bf89d7bbe7b924b5282d533: No such file
> or directory
> error: 0ef31631726cea2e9bf89d7bbe7b924b5282d533: object corrupt or
> missing: .git/objects/0e/f31631726cea2e9bf89d7bbe7b924b5282d533
> [... a dozen similar entries ...]
> error: object file
> .git/objects/f5/a9d125645e69a0e40f9bf7a8c90b1c1c4a4ea5 is empty
> error: unable to mmap
> .git/objects/f5/a9d125645e69a0e40f9bf7a8c90b1c1c4a4ea5: No such file or
> directory
> error: f5a9d125645e69a0e40f9bf7a8c90b1c1c4a4ea5: object corrupt or
> missing: .git/objects/f5/a9d125645e69a0e40f9bf7a8c90b1c1c4a4ea5
> Checking object directories: 100% (256/256), done.
> Checking objects: 100% (1577/1577), done.
> error: refs/stash: invalid sha1 pointer
> 0000000000000000000000000000000000000000
> error: bad ref for .git/logs/refs/stash
> dangling commit 1c0ea4e6159952501957012d2b9db7d68b52d107
> %
> 
> Last time I checked out the previous state from github in a new directory
and
> was able to find and copy over most of my work before continuing. On this
> occasion I did a `git stash save` shortly before the crash, and I'm not
sure
> how to get that back. I see René Scharfe's suggestion of:
>   git fsck --unreachable |
>   grep commit | cut -d\  -f3 |
>   xargs git log --merges --no-walk --grep=WIP from a recent message, but
> that is only showing me an older stash item.

I would suggest turning off write-through buffering on your disk. Let writes
complete immediately instead of being deferred to sync. Also, this does feel
like a disk issue, so fsck or chkdsk /f (or whatever) on your disk urgently.

Good luck,
Randall

-- Brief whoami:
 NonStop developer since approximately 211288444200000000
 UNIX developer since approximately 421664400
-- In my real life, I talk too much.




  parent reply	other threads:[~2020-10-24 22:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-24 20:19 safer git? hv
2020-10-24 20:21 ` hv
2020-10-24 22:11 ` Randall S. Becker [this message]
2020-10-25  3:06   ` brian m. carlson
2020-10-25 12:45     ` hv
2020-10-25 15:17     ` Randall S. Becker

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='016001d6aa52$b1cbc510$15634f30$@nexbridge.com' \
    --to=rsbecker@nexbridge.com \
    --cc=git@vger.kernel.org \
    --cc=hv@crypt.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).