Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken pipe due to fast-import crash #4

Closed
fgb opened this issue Jun 3, 2014 · 29 comments
Closed

Broken pipe due to fast-import crash #4

fgb opened this issue Jun 3, 2014 · 29 comments
Labels

Comments

@fgb
Copy link

fgb commented Jun 3, 2014

Sporadically, I get a broken pipe error when fast-import crashes, which prevents syncing the hg repo.

Here's the relevant output:

git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree fetch origin 
fatal: mark :26940 not declared
fast-import: dumping crash report to .git/fast_import_crash_15105
fatal: Error while running fast-import
Traceback (most recent call last):
  File "/usr/local/bin/git-remote-hg", line 1311, in <module>
    sys.exit(main(sys.argv))
  File "/usr/local/bin/git-remote-hg", line 1295, in main
    do_import(parser)
  File "/usr/local/bin/git-remote-hg", line 721, in do_import
    export_branch(repo, branch)
  File "/usr/local/bin/git-remote-hg", line 613, in export_branch
    export_ref(repo, branch, 'branches', head)
  File "/usr/local/bin/git-remote-hg", line 547, in export_ref
    modified_final = export_files(c.filectx(f) for f in modified)
  File "/usr/local/bin/git-remote-hg", line 288, in export_files
    print d
IOError: [Errno 32] Broken pipe
Completed with errors, see above

The last time this happened, I resolved it by re-cloning the hg repo, which is an extreme solution. I'd rather fix this differently because I keep multiple clones of the git repo that all need to be re-cloned if I alter the original.

Here's the related fast_import_crash_15105:

fast-import crash report:
    fast-import process: 15105
    parent process     : 15104
    at Mon Jun 2 16:56:07 2014

fatal: mark :26940 not declared

Most Recent Commands Before Crash
---------------------------------
  feature done
  feature import-marks=.git/hg/origin/marks-git
  feature export-marks=.git/hg/origin/marks-git
  feature force
  blob
  mark :26952
  data 5144
  blob
  mark :26953
  data 719
  blob
  mark :26954
  data 545
  blob
  mark :26955
  data 363
  blob
  mark :26956
  data 1315
  blob
  mark :26957
  data 181
  blob
  mark :26958
  data 4553
  blob
  mark :26959
  data 1260
  blob
  mark :26960
  data 1346
  blob
  mark :26961
  data 461
  commit refs/hg/origin/branches/default
  mark :26962
  author fgb <unknown> 1401491792 -0700
  committer fgb <unknown> 1401491792 -0700
  data 35
* from :26940

Active Branch LRU
-----------------
    active_branches = 0 cur, 5 max

  pos  clock name
 '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'

Inactive Branches
-----------------
refs/hg/origin/branches/default:
  status      : dirty
  tip commit  : 0000000000000000000000000000000000000000
  old tree    : 0000000000000000000000000000000000000000
  cur tree    : 0000000000000000000000000000000000000000
  commit clock: 0
  last pack   : 


Marks
-----
  exported to .git/hg/origin/marks-git

-------------------
END OF CRASH REPORT

Any help would be welcome. Thanks for the great plugin.

@felipec
Copy link
Owner

felipec commented Jun 3, 2014

The only way I could see this happening is if the mark files somehow get corrupted, which can happen if you get a crash while pushing. This should be fixed if you use the latest Git (2.0), and the latest git-remote-hg (not the original push crash, but the subsequent marks sync crashes).

You can check if your mark files are correctly sync'ed with a tool I wrote:

https://gist.github.com/felipec/10551806

I can run it like:

% git-marks-check --verbose origin

@fgb
Copy link
Author

fgb commented Jun 3, 2014

I'm running git v2.0.0 and since then have been regularly downloading git-remote-hg from this repo as instructed in the readme. The latest git-remote-hg still reports the same issue.

I also ran git-marks-check with the following output:

Missing 0d310edf0cde37a6f1949eae75b36f2ac9c1f4e2 (26926) from git
Missing 298d49c9772f52f781a6f343508e2158c9618a32 (23304) from git
Missing 925d77e3470d6c6aa1ceed0332dfcc334916e9a1 (23916) from git
Missing 34435cbb96533f3b9377cddcb3ee0169ad692fc3 (26885) from git
Missing 595471cf82ede8474e487b4177cffc568647ca66 (23581) from git
Missing 1391f0e5f30e96a3f9c7883187b6a06d02854db6 (24760) from git
Missing 49fe5a310e979544280dd40f81692bc097a7aa85 (26298) from git
Missing 6baf0e7663b207bce003c3e0319a263173449e1c (23862) from git
Missing 817d07c976851546c103f8d8874cd5b3d2a5b4e2 (26940) from git
Missing 5352091acffd97d14199f9088a969acfb9de6390 (26748) from git
Missing 47e91123aa4c40c2822144a9ef9fdb5954eb8ae7 (23729) from git
Missing 1056aa68d33b4b7103d444477bdd34109eaa6907 (24405) from git
Missing 4a6b6f33e55007d892ed7e9b0201dfc170b847d8 (23629) from git
Missing 12560ac3a4383dd5a3c8f63e8cad59c5b1c78d99 (23854) from git
Missing 0bc93160af2c57511843996652a541c3536ba716 (26116) from git
Missing 8530a6bae2724ec357d8dfa3ad58291d38669c5c (26155) from git
Missing 292ac9256b9780a6771beac9032917bd5470758b (24531) from git
Missing 07cf5e553d4ddbbdb0614e0fefb8247d65bbbf97 (23761) from git
Missing 47fbd536f259d0538e37cfe9118549abd6fd2c69 (23928) from git
Missing a1f60d2a3a225a26b45493782e732d50673a41f1 (26142) from git
Missing deba4f4f8d39c9703c760effc436f7cb5dc7ad0f (26171) from git
Missing faa5ff11343d7ee8bbb966d3a9bc1a51d89e90fc (25112) from git
Missing 6da1081cb9319f300351b9c20fc7e9d7fac4eea1 (23555) from git
Missing 520e111c496ba0e34f5db5a1ed2c27cc58cabb0c (26125) from git
Missing 740c31c19644334dbd86b7c7d0bad237ac1eb574 (26696) from git
Missing 1f97e64cd5dd197748ad42e24ae673971698f58c (23949) from git
Missing b0606262b90211ee41231a334ca0c71cc410b0fc (23449) from git
Missing 466ef4835ed7c61dc771c78cb5041a655af9b735 (24419) from git
Missing 761f671f51274f0a51dcc58a65b6938e96439721 (26808) from git
Missing d95ce16d22e3130e2acda7bf39a235855b94063a (24935) from git
Missing 1721e3cbb1807175c09401a02f3ebd9573cc266a (26185) from git
Missing 57aa2a575fdc6b13db68fe84d366185999da24fa (25596) from git
Missing 96e4e8bcd04722892677ac64462dac8f5ba4bd9a (25942) from git
Missing de9639e34a136e1c498a5b2c24f2f105026f874d (26114) from git
Missing 646762e8285f43b81c1ff8352a0d26c9c6045a98 (23849) from git
Missing cf507d1567f5d4e189abe946fbf7855aa5f12051 (26141) from git
Missing d911ebafcaedeb46f99c59aa3294fc8abb91a93b (26198) from git
Missing 76502a7d82f687fae9f42da0ef3b9a018f80117c (25650) from git
Missing 37e3a133152ea0ecd2d18b96209868f69370e50f (25036) from git
Missing 376eb57b7237ebc5a46dd25ac28f4e5003e75273 (24929) from git
Missing e9aae3ce023319a54e83c671dc46b6fce8f552bd (23447) from git
Missing c2c27057c0296042de2d4615a02177942b859ff7 (26805) from git
Missing 4f82b2479ff2f347d2f8535d954b09e2099eaf66 (23768) from git
Missing fb054edf834f13b29206e34e7505b63f30dae2f9 (24632) from git
Missing 4784c6a0e0c55ae200975f8ad46f6f91a79f12c2 (23847) from git
Missing b08fbdefbafce767fb12ea494a25f5a44c1a44aa (26655) from git
Missing d72eb333b6b754ca68fb68e6147fb21c8b122646 (24425) from git
Missing 5f887b797dc1efa0e512e335fbc97bd056981c06 (24394) from git
Missing 7a2cf3dcdaa1849d4c129275d15dfb71869c8f7a (24385) from git
Missing f48a47866965a9dc810c5b87210a6f703cce7a38 (25046) from git
Missing da8ab716f97996db29f16fb119fd4a6a7a030b07 (23307) from git
Missing 5b32aaae59cdc4ee1046543a8b7827b11fcd786b (23851) from git
Missing 20e4849614d68c486b12fa43f02ad1da9b44ae07 (23722) from git
Missing ea7f021e1dbd722a65de971aad55e65aae531a03 (23622) from git
Missing 81a4ebb310c6c166a235cb8478d84c5c5a228797 (26924) from git
Missing 8526509e32a962db23ff3835951b8f4a5db47662 (24390) from git
Missing f58da6a5b976fe511888afe953931a20e5bc5b79 (24535) from git
Missing 4d6a82e6fc0d0bb74e1a3213f2da73dd51264bb8 (23931) from git
Missing 5036b1a6b0d3edffccb80c296c07e7f8d6774231 (23531) from git
Missing 1b8f4fd3723551d589fc5574d2038f5191b3bbe7 (24017) from git
Missing 6e36282ccb65f0e05d8d34dc98bbd7e22d6cc99f (24559) from git
Missing 441cf401ab9db8a29af04385978685af1ebfaa63 (23914) from git
Missing 8d0b7f75e5d543917a75527215ec9ccd9aeab1db (24400) from git
Missing 06db6b7838510d5ea8c5f4df208f5e5f36f43c6f (23926) from git
Missing 633ecd3c2e03f05689bc79989721258b009b54ab (23919) from git
Missing 045d941a871da1f3f3ecdb34e4ffdc23be24cf71 (23843) from git
Missing 5cf8988168fc9f60f4944a828a06b97663d1abd9 (23558) from git
Missing 0418ea618ad14e4a8b550bc665ab4064ce0a3302 (25662) from git
Missing 5701cdbaebcbedc8630a8a902d217d31c12c6fb7 (26161) from git
Missing 0c4741f2b5ed54543c8d1e1ae5dc0800b805c2d5 (26176) from git
Missing f05fb802175911b996e0f2ad9f1db0e5ad56472d (26018) from git
Missing 34a5adbb7c493eed540f0e4c8c10a27d2daac21e (26351) from git
Missing e4379c8fff56144a3b695f2ad034ef66bebeb3b1 (23538) from git
Missing 44c13d928959547d1cfb3e397cb2a9f777489952 (24427) from git
Missing 31f41b531df41e74eac1d975ee28023acdb18212 (26836) from git
Missing b515dd48311957c6982227c0c49db9540252ec90 (23845) from git
Missing c13965180e543c33dd93b2c4b1b96af95c1c2b65 (24413) from git
Missing dda66ebabf8775414ba65e626c42594a56f0140c (26368) from git
Missing c531046be7546388b64e1f59f1dc39e0d3ce527a (26193) from git
Missing 945f35754762a409678ccdbe73e7ea83d65d21e7 (23781) from git
Missing bbb9176c1df30da4c4bb377315310fbf12d19b3b (26258) from git
Missing 5214e459cb6bf248ca80f42ff553519754363028 (26195) from git
Missing 9a5694fba1cb06b39608c611e58f5bf11a90cef5 (24049) from git
Missing a0689cd20e6e782b0e0d9339d12819bae26211a1 (25104) from git
Issues detected

Is there any chance to re-generate or fix the mark files without re-cloning the repo?

@felipec
Copy link
Owner

felipec commented Jun 3, 2014

I'm running git v2.0.0 and since then have been regularly downloading git-remote-hg from this repo as instructed in the readme.

That will prevent future desynchronizations, it won't help with the already screwed up marks.

You can try doing this:

% git-marks-check --fix origin

That will remove the marks that are missing from one side. In theory they will be synchronized the next time you fetch.

@fgb
Copy link
Author

fgb commented Jun 3, 2014

Not quite there. Running that command resulted in Issues detected, but running the previous command again yielded Everything OK. This was promising until I tried to fetch once again:

git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree fetch origin 
Traceback (most recent call last):
  File "/usr/local/bin/git-remote-hg", line 1322, in <module>
    sys.exit(main(sys.argv))
  File "/usr/local/bin/git-remote-hg", line 1306, in main
    do_import(parser)
  File "/usr/local/bin/git-remote-hg", line 721, in do_import
    export_branch(repo, branch)
  File "/usr/local/bin/git-remote-hg", line 613, in export_branch
    export_ref(repo, branch, 'branches', head)
  File "/usr/local/bin/git-remote-hg", line 557, in export_ref
    print "from :%s" % (rev_to_mark(parents[0]))
  File "/usr/local/bin/git-remote-hg", line 440, in rev_to_mark
    return marks.from_rev(rev.hex())
  File "/usr/local/bin/git-remote-hg", line 173, in from_rev
    return self.marks[rev]
KeyError: '817d07c976851546c103f8d8874cd5b3d2a5b4e2'
fatal: stream ends early
fast-import: dumping crash report to .git/fast_import_crash_33170
fatal: Error while running fast-import
Completed with errors, see above

With the corresponding fast_import_crash_33170:

fast-import crash report:
    fast-import process: 33170
    parent process     : 33169
    at Tue Jun 3 14:48:31 2014

fatal: stream ends early

Most Recent Commands Before Crash
---------------------------------
  feature done
  feature import-marks=.git/hg/origin/marks-git
  feature export-marks=.git/hg/origin/marks-git
  feature force
  blob
  mark :26952
  data 5144
  blob
  mark :26953
  data 719
  blob
  mark :26954
  data 545
  blob
  mark :26955
  data 363
  blob
  mark :26956
  data 1315
  blob
  mark :26957
  data 181
  blob
  mark :26958
  data 4553
  blob
  mark :26959
  data 1260
  blob
  mark :26960
  data 1346
  blob
  mark :26961
  data 461
  commit refs/hg/origin/branches/default
  mark :26962
  author fgb <unknown> 1401491792 -0700
  committer fgb <unknown> 1401491792 -0700
* data 35

Active Branch LRU
-----------------
    active_branches = 1 cur, 5 max

  pos  clock name
  '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
   1)      1 refs/hg/origin/branches/default

Inactive Branches
-----------------
refs/hg/origin/branches/default:
  status      : active loaded
  tip commit  : 45cd06c733b46ea8aa6f7c3f0ae7f0aed101f94e
  old tree    : 4b825dc642cb6eb9a060e54bf8d69288fbee4904
  cur tree    : 4b825dc642cb6eb9a060e54bf8d69288fbee4904
  commit clock: 1
  last pack   : 0


Marks
-----
  exported to .git/hg/origin/marks-git

-------------------
END OF CRASH REPORT

@felipec
Copy link
Owner

felipec commented Jun 3, 2014

Do you have that commit in the repository? (817d07c976851546c103f8d8874cd5b3d2a5b4e2), and is that commit in the 'marks-hg' file?

@felipec
Copy link
Owner

felipec commented Jun 3, 2014

Actually, maybe you need to remove the contents of the "tips" section in the 'marks-hg' file.

@fgb
Copy link
Author

fgb commented Jun 3, 2014

That commit is not in the git repo or the marks-git file. Why are there two sets of marks files (under .git/hg/hg/ and under .git/hg/origin/)?

Removing the contents of tips from both marks-hg files and then trying to fetch yielded:

git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree fetch origin 
fatal: mark :26951 not declared
fast-import: dumping crash report to .git/fast_import_crash_34635
fatal: Error while running fast-import
progress revision 2799 'default' (2800/2819)
Traceback (most recent call last):
  File "/usr/local/bin/git-remote-hg", line 1322, in <module>
    sys.exit(main(sys.argv))
  File "/usr/local/bin/git-remote-hg", line 1306, in main
    do_import(parser)
  File "/usr/local/bin/git-remote-hg", line 721, in do_import
    export_branch(repo, branch)
  File "/usr/local/bin/git-remote-hg", line 613, in export_branch
    export_ref(repo, branch, 'branches', head)
  File "/usr/local/bin/git-remote-hg", line 596, in export_ref
    print msg
IOError: [Errno 32] Broken pipe
Completed with errors, see above

The corresponding output from fast_import_crash_34635 is:

fast-import crash report:
    fast-import process: 34635
    parent process     : 34634
    at Tue Jun 3 16:03:06 2014

fatal: mark :26951 not declared

Most Recent Commands Before Crash
---------------------------------
  data 63
  from :27304

  blob
  mark :27308
  data 3492
  blob
  mark :27309
  data 1539
  blob
  mark :27310
  data 9439
  blob
  mark :27311
  data 3698
  blob
  mark :27312
  data 1961
  blob
  mark :27313
  data 1841
  blob
  mark :27314
  data 17808
  blob
  mark :27315
  data 3348
  commit refs/hg/origin/branches/default
  mark :27316
  author fgb <unknown> 1401750184 -0700
  committer fgb <unknown> 1401750184 -0700
  data 67
  from :27307

  blob
  mark :27317
  data 2738
  commit refs/hg/origin/branches/default
  mark :27318
  author fgb <unknown> 1401750201 -0700
  committer fgb <unknown> 1401750201 -0700
  data 41
  from :27316

  blob
  mark :27319
  data 9491
  blob
  mark :27320
  data 15547
  commit refs/hg/origin/branches/default
  mark :27321
  author fgb <unknown> 1401751151 -0700
  committer fgb <unknown> 1401751151 -0700
  data 64
  from :27318

  blob
  mark :27322
  data 1217
  commit refs/hg/origin/branches/default
  mark :27323
  author fgb <unknown> 1401819763 -0700
  committer fgb <unknown> 1401819763 -0700
  data 46
  from :27321

  blob
  mark :27324
  data 1043
  commit refs/hg/origin/branches/default
  mark :27325
  author fgb <unknown> 1401822574 -0700
  committer fgb <unknown> 1401822574 -0700
  data 90
  from :27323

  reset refs/hg/origin/branches/default
  from :27325

  commit refs/notes/hg
  mark :27326
  committer remote-hg <> 1401836586 -0800
  data 18
* from :26951

Active Branch LRU
-----------------
    active_branches = 1 cur, 5 max

  pos  clock name
  '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
   1)      0 refs/hg/origin/branches/default

Inactive Branches
-----------------
refs/hg/origin/branches/default:
  status      : active
  tip commit  : c686c467a31b077bfc65bec1184e8008905bf414
  old tree    : 150a8e5ac76e89fd4d262af07315b0a330455a32
  cur tree    : 150a8e5ac76e89fd4d262af07315b0a330455a32
  commit clock: 0
  last pack   :

refs/notes/hg:
  status      : dirty
  tip commit  : 0000000000000000000000000000000000000000
  old tree    : 0000000000000000000000000000000000000000
  cur tree    : 0000000000000000000000000000000000000000
  commit clock: 0
  last pack   :


Marks
-----
  exported to .git/hg/origin/marks-git

-------------------
END OF CRASH REPORT

Running git-marks-check after this reports a bunch of missing marks.

@felipec
Copy link
Owner

felipec commented Jun 3, 2014

That commit is not in the git repo or the marks-git file.

Not in the Git repo, in the Mercurial repo, and not in the marks-git file, in the marks-hg file.

And in order to fix it you should both run git-marks-check --fix, and remove the 'tips' section before running git fetch again.

@fgb
Copy link
Author

fgb commented Jun 4, 2014

My bad. It's both in the hg repo and the marks-hg file, but only within the tips dictionary. default and bookmarks/master point to it.

I ran git-marks-check --fix and removed the tips contents before running git fetch, which is what I was doing above, and I got the exact same error as my previous post.

@fgb
Copy link
Author

fgb commented Jun 4, 2014

FYI: The content of tips don't get regenerated for either of the marks-hg files.

Is .git/hg/hg/ a deprecated location of the marks files?

@felipec
Copy link
Owner

felipec commented Jun 4, 2014

Actually, the error you get about mark 26951 seems to be related to notes, so you probably need to remove the section 'last-note' from the marks-hg file.

Is .git/hg/hg/ a deprecated location of the marks files?

No, that's the location of the hg information about the "hg" remote. Do you have a remote named "hg"? If not, maybe you did in the past and you can safely remove that.

@fgb
Copy link
Author

fgb commented Jun 4, 2014

That did it! I ran git-marks-check --fix, removed both the contents of the 'tips' dictionary and the 'last-note' key/value pair that was pointing to 26951, and I'm now able to fetch from the hg repo. It properly re-instated 'last-note' and the contents of 'tips' after the successful run.

Do you have a remote named "hg"? If not, maybe you did in the past and you can safely remove that.

I once renamed the 'origin' remote 'hg', which explains the out-of-date contents of those marks files, but I've since reverted back to naming it 'origin'. I seem to remember that it wouldn't push to the hg repo when the remote was named anything but 'origin', but I can be mistaken.

Thanks for the prompt response and for sticking around until this got resolved!

@felipec
Copy link
Owner

felipec commented Jun 4, 2014

Cool. This synchronization issue shouldn't happen again if you are using Git v2.0 and a recent git-remote-hg. So I'll close this as resolved, reopen if it happens again.

@felipec felipec closed this as completed Jun 4, 2014
@fgb
Copy link
Author

fgb commented Jun 6, 2014

Well, today it happened again, but thankfully the same fix worked.

I'm beginning to understand what might be triggering the issue, so there's a chance you might be able to reproduce it. My setup is as follows: I have a copy of the mercurial repo stored locally, from which I cloned the git repo. My project enforces a workflow where all commits have to be rebased instead of merged, so when I was ready to push a commit today, I:

  • pulled the changes from the remote hg repo into my local clone,
  • pulled them into the git clone,
  • rebased the commit in git, and then
  • pushed it to the local hg repo.

For some reason, the commit appeared on the hg repo orphaned from the history. I proceeded to strip the commit from the hg repo, after which I could no longer fetch from git. The cause seems to be simple. The marks-hg file's 'last-note' was now pointing to a commit that wasn't there. I ran git-marks-check --fix, deleted the 'last-note' key/value pair in marks-hg and fetched again, this time successfully. Worried that the problem might reappear if I pushed the same commit over, I re-generated the commit. Now the push worked as expected.

At this point, I'm not sure whether git-marks-check --fix was necessary at all. What I do know, though, is that after running that script, the dictionary inside the marks-hg file lost a bunch of spaces. Since that dictionary is written in 1 line, I word-wrapped it on my editor and the lack of spaces after fixing it made it really hard to follow. Then again, this is just a minor annoyance.

Hopefully you'll be able to reproduce the error and tweak git-remote-hg to handle this scenario. I wish I didn't have to constantly rebase, but that's the name of the game here. Let me know if I can be of help. Also, It wouldn't let me re-open the issue, so I'll let you handle that however you see fit.

@fgb
Copy link
Author

fgb commented Jun 18, 2014

@felipec: Were you able to reproduce the issue?

@fgb
Copy link
Author

fgb commented Sep 3, 2014

This issue reappeared today. Here's a succinct summary of a way to resolve it for future reference:

  1. download git-marks-check and run git-marks-check --fix [REMOTE], which should report 'Issues detected' and fix them,
  2. remove the "last-note" key-value pair and the contents of the "tips" dictionary from .git/hg/[REMOTE]/marks-hg,
  3. git fetch [REMOTE] should now succeed.

@alchemicalhydra
Copy link

I just ran into this issue and the steps provided by @fgb did the trick. Thanks!

@alchemicalhydra
Copy link

I'm starting to hit this issue constantly. I'm almost ready to set up an alias that runs the above steps before every fetch. :-/

@alchemicalhydra
Copy link

git-marks-check --fix origin is now consistently returning Everything OK, yet I'm still getting the mark :[number] not declared / Broken pipe crash on every fetch now, unless I edit .git/hg/[remote]/marks-hg before the fetch.

@fgb
Copy link
Author

fgb commented Oct 7, 2014

@tomxtobin: that sounds a lot worse than what I've been experiencing. I bump into this issue when fetching from the mercurial repo and then proceeding to alter its history. The next fetch always fails with the broken pipe issue because the last commit git pulled from hg is no longer there (i.e. the tip's hash has changed).

fingolfin added a commit to fingolfin/git-remote-hg that referenced this issue Oct 28, 2014
This doesn't solve the actual issues, but helps mitigate them in many
cases.

I am not completely sure what the "actual" issues are, but one seems to
be that it is apparently relatively easy to end up with a corrupt marks
file (and indeed, the code loading / saving marks does not attempt to be
particular robust).

The other problem hinted at in issue #4 seems to  be when tips in the
remote hg repository change, then this seems to also cause troubles.

See also:
  felipec#4
  felipec#10
@Lekensteyn
Copy link

Has anyone actually managed to create a reproducible test case? Spent a few hours in trying to hunt the cause, but failed. The marks-git file was missing marks which appeared in marks-hg after the crash. Could it be related to closed branches and merges?

What I did find was a corrupted hg repo. That is, when running hg verify in $GIT_DIR/hg/, some corruption was reported back to revision 0.

The first crash report (after git fetch):

fast-import crash report:
    fast-import process: 26023
    parent process     : 26022
    at Mon Dec 29 17:01:38 2014

fatal: object not found: e0899a83b684e277c701cace820a92f0bfd6d173

Most Recent Commands Before Crash
---------------------------------
  feature done
  feature import-marks=.git/hg/origin/marks-git
  feature export-marks=.git/hg/origin/marks-git
* feature force

Active Branch LRU
-----------------
    active_branches = 0 cur, 5 max

  pos  clock name
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Inactive Branches
-----------------

Marks
-----
  exported to .git/hg/origin/marks-git

-------------------
END OF CRASH REPORT

Further git fetches will always result in this crash:

fast-import crash report:
    fast-import process: 26042
    parent process     : 26041
    at Mon Dec 29 17:02:20 2014

fatal: mark :6222 not declared

Most Recent Commands Before Crash
---------------------------------
  feature done
  feature import-marks=.git/hg/origin/marks-git
  feature export-marks=.git/hg/origin/marks-git
  feature force
  reset refs/hg/origin/branches/pagination
* from :6222

Active Branch LRU
-----------------
    active_branches = 0 cur, 5 max

  pos  clock name
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Inactive Branches
-----------------
refs/hg/origin/branches/pagination:
  status      : dirty
  tip commit  : 0000000000000000000000000000000000000000
  old tree    : 0000000000000000000000000000000000000000
  cur tree    : 0000000000000000000000000000000000000000
  commit clock: 0
  last pack   : 


Marks
-----
  exported to .git/hg/origin/marks-git

-------------------
END OF CRASH REPORT

fingolfin added a commit to fingolfin/git-remote-hg that referenced this issue Jan 13, 2015
This doesn't solve the actual issues, but helps mitigate them in many
cases.

I am not completely sure what the "actual" issues are, but one seems to
be that it is apparently relatively easy to end up with a corrupt marks
file (and indeed, the code loading / saving marks does not attempt to be
particular robust).

The other problem hinted at in issue #4 seems to  be when tips in the
remote hg repository change, then this seems to also cause troubles.

See also:
  felipec#4
  felipec#10
@fgb
Copy link
Author

fgb commented Feb 28, 2015

@Lekensteyn: Maybe a closed branch or a merge can trigger it, but it hasn't been my experience. I rarely close a branch in hg and have merged branches in git and hg and pulled / pushed them across git-remote-hg without issues.

@fgb
Copy link
Author

fgb commented Feb 28, 2015

@tomxtobin: Are you still experiencing the crippling broken pipe on every fetch?

@alchemicalhydra
Copy link

@fgb Yes, nothing's changed there, unfortunately.

@felipec felipec added bug and removed question labels May 17, 2016
@felipec
Copy link
Owner

felipec commented May 17, 2016

We need to create a script that reproduces this issue.

@felipec
Copy link
Owner

felipec commented May 17, 2016

For some reason, the commit appeared on the hg repo orphaned from the history.

That is strange. We'll need to find a way to reproduce that, but that's separate from the issue here.

I proceeded to strip the commit from the hg repo, after which I could no longer fetch from git. The cause seems to be simple. The marks-hg file's 'last-note' was now pointing to a commit that wasn't there.

That is not so simple. A lot of things need to go wrong for the last-note to not be there. And that is the issue that is breaking things for you.

I've found a way to reproduce this, but again, that's separate from the original bug. I've opened a new issue (#56).

@felipec felipec closed this as completed May 17, 2016
@eregon
Copy link

eregon commented Jul 15, 2016

As a simple workaround, it seems deleting the mark files and git pull after solves the problem:

rm .git/hg/origin/marks-*

@nengxu
Copy link

nengxu commented Jul 22, 2016

@eregon Thanks for your tip!

@fgb
Copy link
Author

fgb commented Aug 18, 2016

@eregon Great tip! It does take a bit to regenerate the mark files, but it seems to be a great way to fix/reset git-remote-hg in the worst case scenario short of re-cloning the hg repo.

fgb pushed a commit to fgb/git-remote-hg that referenced this issue Mar 1, 2018
Optionally don't mangle git usernames with quotes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants