quorumcontrol / dgit

dgit adds decentralized ownership to git - powered by Tupelo DLT and Skynet
https://dgit.dev/
MIT License
208 stars 16 forks source link

panic on git pull #52

Open leonklingele opened 4 years ago

leonklingele commented 4 years ago
# Installed via Homebrew
$ dgit version
dgit version v0.0.11-alpha

$ git init
Initialized empty Git repository in /tmp/.git/

$ dgit init
What is your full repo name? demo/demo█

dgit would like to add the 'dgit' remote to this repo so that you can fetch directly from dgit.

Is that ok? y█

Success, dgit is now accessible under the 'dgit' remote.
[..]

$ git remote -v
dgit    dgit://demo/demo (fetch)
dgit    dgit://demo/demo (push)

$ git pull dgit
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x49033c8]

goroutine 1 [running]:
github.com/quorumcontrol/dgit/storage/siaskynet.(*ObjectStorage).EncodedObject(0xc0008a67c0, 0x8cc43ca31694a381, 0xbd6ff0d74a50780f, 0x3fafe2a349, 0x4816b48, 0x30, 0x30, 0xc0008e1470)
    /tmp/dgit-20200328-88368-1hlrr3v/quorumcontrol-dgit-512ba95/storage/siaskynet/object.go:313 +0x678
github.com/go-git/go-git/v5/plumbing/revlist.processObject(0x2d70d870, 0xc0007a48c0, 0xf8cc43ca31694a3, 0x49bd6ff0d74a5078, 0xc03fafe2a3, 0xc0008e1470, 0xc0005c32d8, 0x0, 0x0, 0x0, ...)
    /tmp/dgit-20200328-88368-1hlrr3v/quorumcontrol-dgit-512ba95/go/pkg/mod/github.com/go-git/go-git/v5@v5.0.1-0.20200319142726-f6305131a06b/plumbing/revlist/revlist.go:88 +0xc0
github.com/go-git/go-git/v5/plumbing/revlist.objects(0x2d70d870, 0xc0007a48c0, 0xc0007ac000, 0x1, 0x1, 0x0, 0x0, 0x0, 0xc0004cf300, 0x0, ...)
    /tmp/dgit-20200328-88368-1hlrr3v/quorumcontrol-dgit-512ba95/go/pkg/mod/github.com/go-git/go-git/v5@v5.0.1-0.20200319142726-f6305131a06b/plumbing/revlist/revlist.go:63 +0x264
github.com/go-git/go-git/v5/plumbing/revlist.ObjectsWithStorageForIgnores(0x2d70d870, 0xc0007a48c0, 0x2d70d870, 0xc0007a48c0, 0xc0007ac000, 0x1, 0x1, 0x0, 0x0, 0x0, ...)
    /tmp/dgit-20200328-88368-1hlrr3v/quorumcontrol-dgit-512ba95/go/pkg/mod/github.com/go-git/go-git/v5@v5.0.1-0.20200319142726-f6305131a06b/plumbing/revlist/revlist.go:42 +0x124
github.com/go-git/go-git/v5/plumbing/revlist.Objects(...)
    /tmp/dgit-20200328-88368-1hlrr3v/quorumcontrol-dgit-512ba95/go/pkg/mod/github.com/go-git/go-git/v5@v5.0.1-0.20200319142726-f6305131a06b/plumbing/revlist/revlist.go:24
github.com/go-git/go-git/v5/plumbing/transport/server.(*upSession).objectsToUpload(0xc0008a67e0, 0xc00015fec0, 0x0, 0x0, 0x0, 0x0, 0x4a84600)
    /tmp/dgit-20200328-88368-1hlrr3v/quorumcontrol-dgit-512ba95/go/pkg/mod/github.com/go-git/go-git/v5@v5.0.1-0.20200319142726-f6305131a06b/plumbing/transport/server/server.go:184 +0x1aa
github.com/go-git/go-git/v5/plumbing/transport/server.(*upSession).UploadPack(0xc0008a67e0, 0x4e8e9c0, 0xc0002e7f00, 0xc00015fec0, 0x0, 0x0, 0x0)
    /tmp/dgit-20200328-88368-1hlrr3v/quorumcontrol-dgit-512ba95/go/pkg/mod/github.com/go-git/go-git/v5@v5.0.1-0.20200319142726-f6305131a06b/plumbing/transport/server/server.go:160 +0x128
github.com/go-git/go-git/v5.(*Remote).fetchPack(0xc0005c3930, 0x4e8e9c0, 0xc0002e7f00, 0xc0005c3b38, 0x4e87940, 0xc0008a67e0, 0xc00015fec0, 0x0, 0x0)
    /tmp/dgit-20200328-88368-1hlrr3v/quorumcontrol-dgit-512ba95/go/pkg/mod/github.com/go-git/go-git/v5@v5.0.1-0.20200319142726-f6305131a06b/remote.go:380 +0x7f
github.com/go-git/go-git/v5.(*Remote).fetch(0xc0005c3930, 0x4e8e9c0, 0xc0002e7f00, 0xc0005c3b38, 0x0, 0x0, 0x0, 0x0)
    /tmp/dgit-20200328-88368-1hlrr3v/quorumcontrol-dgit-512ba95/go/pkg/mod/github.com/go-git/go-git/v5@v5.0.1-0.20200319142726-f6305131a06b/remote.go:328 +0x6ac
github.com/go-git/go-git/v5.(*Remote).FetchContext(...)
    /tmp/dgit-20200328-88368-1hlrr3v/quorumcontrol-dgit-512ba95/go/pkg/mod/github.com/go-git/go-git/v5@v5.0.1-0.20200319142726-f6305131a06b/remote.go:263
github.com/quorumcontrol/dgit/remotehelper.(*Runner).Run(0xc0005c3cb0, 0x4e8e9c0, 0xc0002e7f00, 0x7fff5fbff7e3, 0x4, 0x7fff5fbff7e8, 0x10, 0x0, 0x0)
    /tmp/dgit-20200328-88368-1hlrr3v/quorumcontrol-dgit-512ba95/remotehelper/runner.go:236 +0x19e7
github.com/quorumcontrol/dgit/cmd.glob..func2(0x56b9d60, 0xc00031eaa0, 0x2, 0x2)
    /tmp/dgit-20200328-88368-1hlrr3v/quorumcontrol-dgit-512ba95/cmd/remotehelper.go:68 +0x8ba
github.com/spf13/cobra.(*Command).execute(0x56b9d60, 0xc00031ea60, 0x2, 0x2, 0x56b9d60, 0xc00031ea60)
    /tmp/dgit-20200328-88368-1hlrr3v/quorumcontrol-dgit-512ba95/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:830 +0x29d
github.com/spf13/cobra.(*Command).ExecuteC(0x56b9fe0, 0x40439ea, 0x55a5dc0, 0xc000000180)
    /tmp/dgit-20200328-88368-1hlrr3v/quorumcontrol-dgit-512ba95/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:914 +0x2fb
github.com/spf13/cobra.(*Command).Execute(...)
    /tmp/dgit-20200328-88368-1hlrr3v/quorumcontrol-dgit-512ba95/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:864
github.com/quorumcontrol/dgit/cmd.Execute()
    /tmp/dgit-20200328-88368-1hlrr3v/quorumcontrol-dgit-512ba95/cmd/root.go:25 +0x36
main.main()
    /tmp/dgit-20200328-88368-1hlrr3v/quorumcontrol-dgit-512ba95/main.go:11 +0x45
leonklingele commented 4 years ago

I get the same panic when git clone dgit://demo/demo directly.

cap10morgan commented 4 years ago

That’s happening because you haven’t pushed anything to the remote yet. But we can definitely handle it better than crashing. Thanks for reporting!

bqv commented 4 years ago

I see a panic when I pull, and my repo is not empty. bqv/nixos.

Recently, pushes have started to fail too.

ryanolsonx commented 4 years ago

I get the same on a git clone after a successful git push.

brandonwestcott commented 4 years ago

hello everyone, thanks for the bug reports - we've identified a couple separate issues here and will be resolving them as fast as possible.

brandonwestcott commented 4 years ago

@leonklingele and @ryanolsonx your issues should be fixed here with the v0.0.13-alpha

@bqv still working on the bug you are running into - its also affecting the dgit://quorumcontrol/dgit repo as well. I've opened a separate issue for that here: https://github.com/quorumcontrol/dgit/issues/56

Thanks all! Please give this new version a try and provide us with any feedback you have.

brandonwestcott commented 4 years ago

@leonklingele / @ryanolsonx , also to clarify you'll need to delete the remote branches from the dgit repo and repush

assuming you have a dgit remote:

git push dgit --delete master
git push dgit master

replacing master with the branch you attempted to previously push.

leonklingele commented 4 years ago

Still broken with dgit version v0.0.13-alpha using the same steps from above :(

brandonwestcott commented 4 years ago

@leonklingele it appears that the demo/demo repo still has pointers to corrupt sia objects for some reason. Using a new remote url should work fine for you, for example:

git remote rm dgit && git remote add dgit dgit://demo/demo2 && env DGIT_OBJ_STORAGE=siaskynet git push dgit

If you are wanting to use demo/demo though, I can help you get it fixed up. I had to apply the same fix to a few of our internal repos. If you want to go this route, can you send the logs from the following?

dgit version && env DGIT_LOG_LEVEL=debug git push dgit --delete master && env DGIT_LOG_LEVEL=debug git push dgit master
leonklingele commented 4 years ago

@brandonwestcott thanks for helping! Here's the output of the second command:

$ dgit version && env DGIT_LOG_LEVEL=debug git push dgit --delete master && env DGIT_LOG_LEVEL=debug git push dgit master
dgit version v0.0.13-alpha
2020-04-04T01:23:04.726+0200    INFO    dgit.cmd    cmd/remotehelper.go:54  dgit remote helper loaded for .git
2020-04-04T01:23:05.847+0200    INFO    dgit.runner remotehelper/runner.go:60   running git-remote-dgit on remote dgit with url dgit://demo/demo
2020-04-04T01:23:05.848+0200    INFO    dgit.runner remotehelper/runner.go:94   received command on stdin capabilities
2020-04-04T01:23:05.848+0200    INFO    dgit.runner remotehelper/runner.go:259  responding to git:
2020-04-04T01:23:05.848+0200    INFO    dgit.runner remotehelper/runner.go:262    *push
2020-04-04T01:23:05.848+0200    INFO    dgit.runner remotehelper/runner.go:262    *fetch
2020-04-04T01:23:05.848+0200    INFO    dgit.runner remotehelper/runner.go:259  responding to git:
2020-04-04T01:23:05.848+0200    INFO    dgit.runner remotehelper/runner.go:262
2020-04-04T01:23:05.848+0200    INFO    dgit.runner remotehelper/runner.go:94   received command on stdin list for-push
2020-04-04T01:23:06.288+0200    DEBUG   dgit.storage.chaintree  chaintree/reference.go:109  fetching references under: [tree data refs]
2020-04-04T01:23:06.288+0200    DEBUG   dgit.storage.chaintree  chaintree/reference.go:109  fetching references under: [tree data refs heads]
2020-04-04T01:23:06.288+0200    DEBUG   dgit.storage.chaintree  chaintree/reference.go:109  fetching references under: [tree data refs heads master]
2020-04-04T01:23:06.289+0200    DEBUG   dgit.storage.chaintree  chaintree/reference.go:132  ref name is: refs/heads/master
2020-04-04T01:23:06.289+0200    DEBUG   dgit.storage.chaintree  chaintree/reference.go:133  val is: [someval]
2020-04-04T01:23:06.289+0200    INFO    dgit.runner remotehelper/runner.go:259  responding to git:
2020-04-04T01:23:06.289+0200    INFO    dgit.runner remotehelper/runner.go:262    @refs/heads/master HEAD
2020-04-04T01:23:06.289+0200    INFO    dgit.runner remotehelper/runner.go:259  responding to git:
2020-04-04T01:23:06.289+0200    INFO    dgit.runner remotehelper/runner.go:262    [someval] refs/heads/master
2020-04-04T01:23:06.289+0200    INFO    dgit.runner remotehelper/runner.go:259  responding to git:
2020-04-04T01:23:06.289+0200    INFO    dgit.runner remotehelper/runner.go:262
2020-04-04T01:23:06.289+0200    INFO    dgit.runner remotehelper/runner.go:94   received command on stdin push :refs/heads/master
2020-04-04T01:23:10.822+0200    DEBUG   dgit.runner remotehelper/runner.go:167  auth for push: private-key-auth 0x..
2020-04-04T01:23:10.832+0200    DEBUG   dgit.storage.chaintree  chaintree/reference.go:109  fetching references under: [tree data refs]
2020-04-04T01:23:10.833+0200    DEBUG   dgit.storage.chaintree  chaintree/reference.go:109  fetching references under: [tree data refs heads]
2020-04-04T01:23:10.833+0200    DEBUG   dgit.storage.chaintree  chaintree/reference.go:109  fetching references under: [tree data refs heads master]
2020-04-04T01:23:10.833+0200    DEBUG   dgit.storage.chaintree  chaintree/reference.go:132  ref name is: refs/heads/master
2020-04-04T01:23:10.833+0200    DEBUG   dgit.storage.chaintree  chaintree/reference.go:133  val is: [someval]
2020-04-04T01:23:10.835+0200    INFO    dgit.runner remotehelper/runner.go:259  responding to git:
2020-04-04T01:23:10.835+0200    INFO    dgit.runner remotehelper/runner.go:262    error refs/heads/master error creating NewAddBlockRequest: error processing block (valid: false): <nil>
2020-04-04T01:23:10.835+0200    INFO    dgit.runner remotehelper/runner.go:94   received command on stdin
To dgit://demo/demo
 ! [remote rejected] master (error creating NewAddBlockRequest: error processing block (valid: false): <nil>)
error: failed to push some refs to 'dgit://demo/demo'
brandonwestcott commented 4 years ago

@leonklingele thanks - I've opened a ticket for a better error message here, but the error processing block (valid: false) indicates that the private key stored for dgit on that machine is not the owner of the repository as stored on the Tupelo network. We are in the process of making username, login, and collaborator improvements, which will help recovery from this issue in the near future.

At this point, its probably easiest to just make a new dgit remote url (example below) - that will ensure that you are the owner:

git remote rm dgit && git remote add dgit dgit://demo/demo2 && env DGIT_OBJ_STORAGE=siaskynet git push dgit

Apologies for the troubles getting rolling - we initially developed this alpha version as an exploration / spike, but we've received an immense amount of great feedback and interest that we are actively investing to make this an awesome tool.

cap10morgan commented 4 years ago

Narrowing the scope of this issue to just "don't crash on git pulling an empty repo." Issues outside of that will be tracked separately.