git-remote-dropbox icon indicating copy to clipboard operation
git-remote-dropbox copied to clipboard

failed to push some refs

Open petRUShka opened this issue 4 years ago • 9 comments

I'm trying to push existing repository to fresh Dropbox repository via git-remote-dropbox. When I try to do it I catch an error:

Pushing to dropbox:///me/reps/repository.git
debug: writing: /me/reps/repository.git/objects/a1/6cdddb802b28e9b7f52b01222117a09f1d89a7
...
debug: writing: /me/reps/repository.git/objects/2b/30cfc121e27ab54eee75b2a7dbdb6244b402f5
Traceback (most recent call last):
  File "/home/user/.local/bin/git-remote-dropbox", line 8, in <module>
    sys.exit(main())
  File "/home/user/.local/lib/python3.9/site-packages/git_remote_dropbox/cli/helper.py", line 23, in main
    helper.run()
  File "/home/user/.local/lib/python3.9/site-packages/git_remote_dropbox/helper.py", line 108, in run
    self._do_push(line)
  File "/home/user/.local/lib/python3.9/site-packages/git_remote_dropbox/helper.py", line 152, in _do_push
    self._push(src, dst)
  File "/home/user/.local/lib/python3.9/site-packages/git_remote_dropbox/helper.py", line 215, in _push
    for done, _ in enumerate(res, 1):
  File "/usr/lib/python3.9/multiprocessing/pool.py", line 870, in next
    raise value
  File "/usr/lib/python3.9/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/home/user/.local/lib/python3.9/site-packages/git_remote_dropbox/util.py", line 103, in __call__
    return method(self._obj, *args)
  File "/home/user/.local/lib/python3.9/site-packages/git_remote_dropbox/helper.py", line 287, in _put_object
    self._connection().files_upload(data, path, mode, mute=True)
  File "/home/user/.local/lib/python3.9/site-packages/dropbox/base.py", line 2861, in files_upload
    r = self.request(
  File "/home/user/.local/lib/python3.9/site-packages/dropbox/dropbox_client.py", line 346, in request
    raise ApiError(res.request_id,
dropbox.exceptions.ApiError: ApiError('dddddddddddddddddddddddddddddddd', UploadError('path', UploadWriteFailed(reason=WriteError('conflict', WriteConflictError('file_ancestor', None)), upload_session_id='AAAAAAAAAAAAAAAAAAAAAA')))
error: failed to push some refs to 'dropbox:///me/reps/repository.git'

There isn't anything in the folder

─➤  ls ~/Dropbox/me/reps/repository.git                                                                                        130 ↵
ls: cannot access '/home/user/Dropbox/me/reps/repository.git': No such file or directory

I've configured remote as follows:

[remote "origin"]
	url = dropbox:///me/reps/repository.git
	fetch = +refs/heads/*:refs/remotes/origin/*

P.S.

─➤  pip list | grep dropbox
dropbox                       11.13.1
git-remote-dropbox            1.1.4

petRUShka avatar Jul 03 '21 20:07 petRUShka

Hmm, I have not seen that kind of error before. The docs say that the file_ancestor error means that "There’s a file at an ancestor path, so we couldn’t create the required parent folders.". Is any of me, me/reps, or me/reps/repository.git a file?

Also, by the way, I recommend using selective sync and disabling sync for the directory where you are placing repos, e.g. /me/reps.

anishathalye avatar Jul 04 '21 11:07 anishathalye

Is any of me, me/reps, or me/reps/repository.git a file?

No, ~/Dropbox/me, ~/Dropbox/me/reps are folders and ~/Dropbox/me/repository.git is absent.

What can I do to help identify the problem?

Also, by the way, I recommend using selective sync and disabling sync for the directory where you are placing repos, e.g. /me/reps.

Thanks! Bit this recommendation isn't related to the issue?

petRUShka avatar Jul 04 '21 20:07 petRUShka

Yeah, the recommendation is probably not related.

I'm not entirely sure what is causing this. Do you get the same error if you try pushing again? Does it seem to be deterministic (i.e. gives an error when pushing the same file), or does it fail at different points?

If you delete the directory in Dropbox (or alternatively, change the remote to point somewhere else, e.g. dropbox:///test) and push, does it still fail in the same way?

What platform are you on? (OS / Python version)

Do you have large files in this repo (say, > 20 MB)?

anishathalye avatar Jul 06 '21 14:07 anishathalye

I've made several experiments. First conclusion: It depends on arbitrary factor.

Push to test have worked perfectly fine:

─➤  git push                                                                                         1 ↵
Writing objects: 100% (5026/5026), done.
To dropbox:///test
 * [new branch]      master -> master

Pushing to me/reps/repository have worked fine. And only pushing to me/reps/repository.git have yold and error:

Writing objects:  37% (1900/5026)
error: exception while writing objects (run with -v for details)

Then I've deleted repository folder from Dropbox and then push it again and everything works fine!

P.S. Repository consists of quite many files (excluding .git config):

ls -alR | wc -l
892

The biggest file has size of 261K and total size of dir is 4.8M.

petRUShka avatar Jul 07 '21 16:07 petRUShka

Okay, so everything is working now? Hard to tell how it got into that state that caused the file_ancestor write conflict. Given that we haven't seen this reported with git-remote-dropbox before, it's possible that it was due to something else.

Yes, the repository consists of many files. git-remote-dropbox keeps all objects loose (supporting packfiles while having client-side concurrency control seemed tricky; it should be possible, but it's not currently implemented). So individual objects are zlib-compressed but there's no delta compression, so repositories take up a decent amount of space.

anishathalye avatar Jul 08 '21 00:07 anishathalye

It seems that ok, but definitely not stable :(

Thanks for your comments!

petRUShka avatar Jul 08 '21 08:07 petRUShka

Do you still have a copy of the folder on Dropbox that was being problematic?

anishathalye avatar Jul 08 '21 10:07 anishathalye

I've tested git push several times in different (and sometimes same) location inside Dropbox folder.

It occasionally fails. It can be ok for location and next time not ok for the same location

petRUShka avatar Jul 08 '21 19:07 petRUShka

git-remote-dropbox doesn't have great logging (and I'm not even sure what log output would be useful beyond the Dropbox API error). It would be helpful for debugging if I could repro this on my machine. I wonder if it has anything to do with the repository contents? Does the same issue happen if you push other repos? (E.g. clone a random github repo, like git-remote-dropbox, and then push it to Dropbox). Or is it just with your particular repo?

anishathalye avatar Jul 11 '21 16:07 anishathalye