Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Rare SIGSEGV in fillREFDeltaObjectContent #682

Closed
vmarkovtsev opened this issue Dec 7, 2017 · 6 comments
Closed

Rare SIGSEGV in fillREFDeltaObjectContent #682

vmarkovtsev opened this issue Dec 7, 2017 · 6 comments

Comments

@vmarkovtsev
Copy link
Contributor

I run the same code from src-d/hercules around 50 times and it works. On 51st, I get the following SIGSEGV:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x48 pc=0x621dce]
goroutine 1 [running]:
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).fillREFDeltaObjectContent(0xc4200109c0, 0x1574640, 0xc420c61200, 0xd769e2e5682e8a44, 0x72bec494cfa7b359, 0xbf527d77, 0x4098cc, 0xc420c33cbc, 0x541430c2)
	/home/travis/gopath/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:365 +0xee
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).decodeByHeader(0xc4200109c0, 0xc420c611c0, 0x15665c0, 0xc420072d90, 0xc420c71101, 0x14)
	/home/travis/gopath/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:288 +0x104
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).decodeIfSpecificType(0xc4200109c0, 0xc420c611c0, 0x0, 0x0, 0x0, 0x0)
	/home/travis/gopath/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:234 +0x306
gopkg.in/src-d/go-git.v4/plumbing/format/packfile.(*Decoder).DecodeObject(0xc4200109c0, 0x0, 0x0, 0x0, 0x0)
	/home/travis/gopath/src/gopkg.in/src-d/go-git.v4/plumbing/format/packfile/decoder.go:219 +0xa7
gopkg.in/src-d/go-git.v4/storage/filesystem.(*packfileIter).Next(0xc4209cf9b0, 0xc420c33df8, 0x5a4281, 0xc420c577a0, 0x1574640)
	/home/travis/gopath/src/gopkg.in/src-d/go-git.v4/storage/filesystem/object.go:412 +0x41
gopkg.in/src-d/go-git.v4/plumbing/storer.(*MultiEncodedObjectIter).Next(0xc4209f5c00, 0xc420010600, 0x1574640, 0xc420c610c0, 0xc420c577a0)
	/home/travis/gopath/src/gopkg.in/src-d/go-git.v4/plumbing/storer/object.go:205 +0x47
gopkg.in/src-d/go-git.v4/plumbing/object.(*storerCommitIter).Next(0xc4209f5c20, 0xc420c577a0, 0x0, 0x0)
	/home/travis/gopath/src/gopkg.in/src-d/go-git.v4/plumbing/object/commit.go:271 +0x37
gopkg.in/src-d/hercules%2ev3.init.11()
	/home/travis/gopath/src/gopkg.in/src-d/hercules.v3/pipeline_test.go:410 +0x56d
gopkg.in/src-d/hercules%2ev3.init()
	/home/travis/gopath/src/gopkg.in/src-d/hercules.v3/uast_test.go:302 +0x246
main.init()
	gopkg.in/src-d/hercules.v3/_test/_testmain.go:326 +0x5a
exit status 2

Link to Travis build

Again, the very same code worked OK in a different Travis node as well as worked OK before.

@vmarkovtsev
Copy link
Contributor Author

I really hope that I will not have to heat my RAM chips... It happened again with the same stack trace. Unable to reproduce on my machine, only happens in Travis.

@vmarkovtsev
Copy link
Contributor Author

I found the rule: it always crashes continuous-integration/travis-ci/pr and always passes continuous-integration/travis-ci/push

@vmarkovtsev
Copy link
Contributor Author

I found the way to reproduce this:

git clone --depth=50 https://github.com/src-d/hercules.git src-d/hercules
cd src-d/hercules/
git fetch origin +refs/pull/21/merge
git checkout -qf FETCH_HEAD
go run reproduce.go

reproduce.go

package main

import (
  "io"
  "gopkg.in/src-d/go-git.v4"
)

func main() {
  repository, _ := git.PlainOpen(".")
  iter, _ := repository.CommitObjects()
  var err error
  for ; err != io.EOF; _, err = iter.Next() {
    if err != nil {
      panic(err)
    }
  }
}

@ajnavarro
Copy link
Contributor

I think you are using an old go-git version. The lines on the panic do not correspond with the latest version on master: https://github.com/src-d/go-git/blob/master/plumbing/format/packfile/decoder.go .

Can you check the commit that are you using into the go-git package? thanks.

@vmarkovtsev
Copy link
Contributor Author

Travis should fetch the latest commit corresponding to v4. Did we forget to update the tag?

@vmarkovtsev
Copy link
Contributor Author

Is not reproduced on master. Waiting for the new release impatiently.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants