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

Null pointer panic on dep init #351

Closed
BTBurke opened this issue Mar 25, 2017 · 9 comments
Closed

Null pointer panic on dep init #351

BTBurke opened this issue Mar 25, 2017 · 9 comments
Assignees

Comments

@BTBurke
Copy link

BTBurke commented Mar 25, 2017

I was running dep init for the first time on a Caddy server plugin.

dep init -v 
dep: Finding dependencies for "github.com/BTBurke/caddy-jwt"...
dep: Found 1 dependencies.
dep: Building dependency graph...
dep: Found import of "github.com/dgrijalva/jwt-go", analyzing...
dep: Found import of "github.com/mholt/caddy", analyzing...
dep: Found import of "github.com/onsi/ginkgo", analyzing...
dep: Found import of "github.com/onsi/gomega", analyzing...
dep: Analyzing transitive imports...
dep: Analyzing "github.com/dgrijalva/jwt-go"...
dep: Analyzing "github.com/mholt/caddy"...
dep: Analyzing "github.com/flynn/go-shlex"...
dep: Analyzing "github.com/mholt/caddy/caddyhttp/httpserver"...
dep: Analyzing "github.com/hashicorp/go-syslog"...
dep: Analyzing "github.com/lucas-clemente/quic-go/h2quic"...
dep: Analyzing "github.com/aead/chacha20"...
dep: Analyzing "github.com/clipperhouse/linkedlist"...
dep: Analyzing "github.com/clipperhouse/slice"...
dep: Analyzing "github.com/clipperhouse/stringer"...
dep: Analyzing "github.com/hashicorp/golang-lru"...
dep: Analyzing "github.com/lucas-clemente/aes12"...
dep: Analyzing "github.com/lucas-clemente/fnv128a"...
dep: Analyzing "github.com/lucas-clemente/quic-go-certificates"...
dep: Analyzing "golang.org/x/crypto/curve25519"...
dep: Analyzing "golang.org/x/crypto/hkdf"...
dep: Analyzing "golang.org/x/net/http2"...
Cached github.com/dgrijalva/jwt-go
Cached github.com/flynn/go-shlex
Cached github.com/hashicorp/go-syslog
dep: Analyzing "golang.org/x/text/secure/bidirule"...
Cached github.com/onsi/ginkgo
Cached github.com/mholt/caddy
Cached github.com/lucas-clemente/quic-go
dep: Analyzing "golang.org/x/text/unicode/norm"...
dep: Analyzing "golang.org/x/net/http2/hpack"...
dep: Analyzing "golang.org/x/net/idna"...
dep: Analyzing "golang.org/x/net/lex/httplex"...
dep: Analyzing "github.com/russross/blackfriday"...
dep: Analyzing "github.com/shurcooL/sanitized_anchor_name"...
dep: Analyzing "github.com/xenolf/lego/acme"...
dep: Analyzing "github.com/miekg/dns"...
dep: Analyzing "golang.org/x/crypto/ocsp"...
dep: Analyzing "golang.org/x/net/publicsuffix"...
dep: Analyzing "gopkg.in/square/go-jose.v1"...
Cached github.com/onsi/gomega
dep: Analyzing "gopkg.in/natefinch/lumberjack.v2"...
dep: Analyzing "github.com/onsi/ginkgo"...
dep: Analyzing "golang.org/x/sys/unix"...
dep: Analyzing "github.com/onsi/gomega"...
dep: Analyzing "gopkg.in/yaml.v2"...
dep: Solving...
Root project is "github.com/BTBurke/caddy-jwt"
 1 transitively valid internal packages
 5 external packages imported from 4 projects
(0)   ✓ select (root)
(1)	? attempt github.com/dgrijalva/jwt-go with 1 pkgs; at least 1 versions to try
(1)	    try github.com/dgrijalva/jwt-go@master
(1)	✓ select github.com/dgrijalva/jwt-go@master w/1 pkgs
(2)	? attempt github.com/mholt/caddy with 2 pkgs; at least 1 versions to try
(2)	    try github.com/mholt/caddy@master
(2)	✓ select github.com/mholt/caddy@master w/5 pkgs
(3)	? attempt github.com/flynn/go-shlex with 1 pkgs; at least 1 versions to try
(3)	    try github.com/flynn/go-shlex@master
(3)	✓ select github.com/flynn/go-shlex@master w/1 pkgs
(4)	? attempt github.com/hashicorp/go-syslog with 1 pkgs; at least 1 versions to try
(4)	    try github.com/hashicorp/go-syslog@master
(4)	✓ select github.com/hashicorp/go-syslog@master w/1 pkgs
(5)	? attempt github.com/onsi/gomega with 1 pkgs; at least 1 versions to try
(5)	    try github.com/onsi/gomega@master
(5)	✓ select github.com/onsi/gomega@master w/12 pkgs
(6)	? attempt github.com/onsi/ginkgo with 1 pkgs; at least 1 versions to try
(6)	    try github.com/onsi/ginkgo@master
(6)	✓ select github.com/onsi/ginkgo@master w/17 pkgs
(7)	? attempt github.com/lucas-clemente/quic-go with 1 pkgs; at least 1 versions to try
(7)	    try github.com/lucas-clemente/quic-go@master
Cached github.com/hashicorp/golang-lru
Cached github.com/lucas-clemente/quic-go-certificates
Cached github.com/lucas-clemente/fnv128a
Cached github.com/lucas-clemente/aes12
Cached gopkg.in/square/go-jose.v1
Cached github.com/shurcooL/sanitized_anchor_name
Cached github.com/russross/blackfriday
Cached gopkg.in/natefinch/lumberjack.v2
Cached github.com/xenolf/lego
Cached github.com/miekg/dns
Cached gopkg.in/yaml.v2
Cached golang.org/x/crypto
Cached golang.org/x/text
Cached golang.org/x/net
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x752678]

goroutine 1 [running]:
github.com/golang/dep/vendor/github.com/sdboyer/gps.wmToReach.func3(0xc4203f1260, 0x2, 0x2, 0xc4202b8d51, 0x27)
	/home/btburke/projects/golang/src/github.com/golang/dep/vendor/github.com/sdboyer/gps/analysis.go:631 +0x78
github.com/golang/dep/vendor/github.com/sdboyer/gps.wmToReach.func4(0xc4202b8d51, 0x27, 0xc4203f1260, 0x2, 0x2, 0xc4203f1201)
	/home/btburke/projects/golang/src/github.com/golang/dep/vendor/github.com/sdboyer/gps/analysis.go:770 +0x462
github.com/golang/dep/vendor/github.com/sdboyer/gps.wmToReach.func4(0xc42043de61, 0x26, 0xc4203f1260, 0x2, 0x2, 0xc420140701)
	/home/btburke/projects/golang/src/github.com/golang/dep/vendor/github.com/sdboyer/gps/analysis.go:727 +0xd08
github.com/golang/dep/vendor/github.com/sdboyer/gps.wmToReach.func4(0xc42048f560, 0x28, 0xc4201407a0, 0x1, 0x1, 0xc4203f0900)
	/home/btburke/projects/golang/src/github.com/golang/dep/vendor/github.com/sdboyer/gps/analysis.go:727 +0xd08
github.com/golang/dep/vendor/github.com/sdboyer/gps.wmToReach(0xc4204c0200, 0xc4204c0201, 0xc4204c01c0, 0xc4202c7968)
	/home/btburke/projects/golang/src/github.com/golang/dep/vendor/github.com/sdboyer/gps/analysis.go:809 +0xd1c
github.com/golang/dep/vendor/github.com/sdboyer/gps.PackageTree.ToReachMap(0xc42043d650, 0x21, 0xc4202ffa40, 0x10000, 0xc42043c810, 0xa12020, 0xc42049f480)
	/home/btburke/projects/golang/src/github.com/golang/dep/vendor/github.com/sdboyer/gps/analysis.go:525 +0x2c0
github.com/golang/dep/vendor/github.com/sdboyer/gps.(*solver).getImportsAndConstraintsOf(0xc4204722d0, 0xc42043d650, 0x21, 0x0, 0x0, 0xa12020, 0xc42049f480, 0xc42040af90, 0x1, 0x1, ...)
	/home/btburke/projects/golang/src/github.com/golang/dep/vendor/github.com/sdboyer/gps/solver.go:506 +0x1df
github.com/golang/dep/vendor/github.com/sdboyer/gps.(*solver).check(0xc4204722d0, 0xc42043d650, 0x21, 0x0, 0x0, 0xa12020, 0xc42049f480, 0xc42040af90, 0x1, 0x1, ...)
	/home/btburke/projects/golang/src/github.com/golang/dep/vendor/github.com/sdboyer/gps/satisfy.go:34 +0x238
github.com/golang/dep/vendor/github.com/sdboyer/gps.(*solver).findValidVersion(0xc4204722d0, 0xc420081680, 0xc42040af90, 0x1, 0x1, 0x0, 0xc42040af90)
	/home/btburke/projects/golang/src/github.com/golang/dep/vendor/github.com/sdboyer/gps/solver.go:776 +0x2d5
github.com/golang/dep/vendor/github.com/sdboyer/gps.(*solver).createVersionQueue(0xc4204722d0, 0xc42043d650, 0x21, 0x0, 0x0, 0xc42040af90, 0x1, 0x1, 0x0, 0x0, ...)
	/home/btburke/projects/golang/src/github.com/golang/dep/vendor/github.com/sdboyer/gps/solver.go:749 +0xae2
github.com/golang/dep/vendor/github.com/sdboyer/gps.(*solver).solve(0xc4204722d0, 0x0, 0x0, 0xc42043ca80)
	/home/btburke/projects/golang/src/github.com/golang/dep/vendor/github.com/sdboyer/gps/solver.go:366 +0x471
github.com/golang/dep/vendor/github.com/sdboyer/gps.(*solver).Solve(0xc4204722d0, 0x3e, 0xc420016026, 0x1c, 0xc42012ee70)
	/home/btburke/projects/golang/src/github.com/golang/dep/vendor/github.com/sdboyer/gps/solver.go:317 +0x8e
main.(*initCommand).Run(0xa5b3f0, 0xc42014b4a0, 0xc4200103b0, 0x0, 0x0, 0x0, 0x0)
	/home/btburke/projects/golang/src/github.com/golang/dep/cmd/dep/init.go:154 +0xf79
main.main()
	/home/btburke/projects/golang/src/github.com/golang/dep/cmd/dep/main.go:97 +0x64f
@sdboyer
Copy link
Member

sdboyer commented Mar 25, 2017

Oooh, that's a real, proper bug you found there. I'll have a look soon. Thanks!

@sdboyer sdboyer added the bug label Mar 25, 2017
@sdboyer sdboyer self-assigned this Mar 25, 2017
@sdboyer
Copy link
Member

sdboyer commented Apr 4, 2017

Ah ok, so, there's two bugs here. First, there's a problem with the parser; https://github.com/lucas-clemente/quic-go/blob/master/utils/_gen.go is causing it to misidentify that as a package main. Because it thinks it's a main, it drops it from consideration when computing the transitive closure.

However, even though it's been dropped, there are still other internal packages that import it, which means the algorithm creating the transitive closure still tries to visit it. What's weird is that it seems like this case still should be covered. Clearly there's some bit of state I'm missing; I'll keep at it.

@sheerun
Copy link

sheerun commented Apr 10, 2017

Same issue for me:

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

goroutine 1 [running]:
github.com/golang/dep/vendor/github.com/sdboyer/gps/pkgtree.wmToReach.func3(0xc4203aec60, 0x1, 0x1, 0xc4201e04e1, 0x27)
	/Users/sheerun/go/src/github.com/golang/dep/vendor/github.com/sdboyer/gps/pkgtree/pkgtree.go:603 +0x78
github.com/golang/dep/vendor/github.com/sdboyer/gps/pkgtree.wmToReach.func4(0xc4201e04e1, 0x27, 0xc4203aec60, 0x1, 0x1, 0xc4203aec01)
	/Users/sheerun/go/src/github.com/golang/dep/vendor/github.com/sdboyer/gps/pkgtree/pkgtree.go:742 +0x462
github.com/golang/dep/vendor/github.com/sdboyer/gps/pkgtree.wmToReach.func4(0xc4201d9e00, 0x2c, 0xc4203aec60, 0x1, 0x1, 0xc420396f00)
	/Users/sheerun/go/src/github.com/golang/dep/vendor/github.com/sdboyer/gps/pkgtree/pkgtree.go:699 +0xd08
github.com/golang/dep/vendor/github.com/sdboyer/gps/pkgtree.wmToReach(0xc42013e168, 0xc42013e101, 0xc42013e128, 0xc420255768)
	/Users/sheerun/go/src/github.com/golang/dep/vendor/github.com/sdboyer/gps/pkgtree/pkgtree.go:781 +0xd1c
github.com/golang/dep/vendor/github.com/sdboyer/gps/pkgtree.PackageTree.ToReachMap(0xc420298b10, 0x21, 0xc42039b6b0, 0x10000, 0xc4203c8db0, 0x16262c0, 0xc420448e80)
	/Users/sheerun/go/src/github.com/golang/dep/vendor/github.com/sdboyer/gps/pkgtree/pkgtree.go:472 +0x2c0
github.com/golang/dep/vendor/github.com/sdboyer/gps.(*solver).getImportsAndConstraintsOf(0xc42023a4b0, 0xc420298b10, 0x21, 0x0, 0x0, 0x16262c0, 0xc420448e80, 0xc420401d90, 0x1, 0x1, ...)
	/Users/sheerun/go/src/github.com/golang/dep/vendor/github.com/sdboyer/gps/solver.go:525 +0x1df
github.com/golang/dep/vendor/github.com/sdboyer/gps.(*solver).check(0xc42023a4b0, 0xc420298b10, 0x21, 0x0, 0x0, 0x16262c0, 0xc420448e80, 0xc420401d90, 0x1, 0x1, ...)
	/Users/sheerun/go/src/github.com/golang/dep/vendor/github.com/sdboyer/gps/satisfy.go:34 +0x238
github.com/golang/dep/vendor/github.com/sdboyer/gps.(*solver).findValidVersion(0xc42023a4b0, 0xc4204741e0, 0xc420401d90, 0x1, 0x1, 0x0, 0xc420401d90)
	/Users/sheerun/go/src/github.com/golang/dep/vendor/github.com/sdboyer/gps/solver.go:795 +0x2d5
github.com/golang/dep/vendor/github.com/sdboyer/gps.(*solver).createVersionQueue(0xc42023a4b0, 0xc420298b10, 0x21, 0x0, 0x0, 0xc420401d90, 0x1, 0x1, 0x0, 0x0, ...)
	/Users/sheerun/go/src/github.com/golang/dep/vendor/github.com/sdboyer/gps/solver.go:768 +0xae2
github.com/golang/dep/vendor/github.com/sdboyer/gps.(*solver).solve(0xc42023a4b0, 0x0, 0x0, 0xc4203c8ea0)
	/Users/sheerun/go/src/github.com/golang/dep/vendor/github.com/sdboyer/gps/solver.go:385 +0x471
github.com/golang/dep/vendor/github.com/sdboyer/gps.(*solver).Solve(0xc42023a4b0, 0x37, 0xc42001205a, 0x21, 0xc420168b10)
	/Users/sheerun/go/src/github.com/golang/dep/vendor/github.com/sdboyer/gps/solver.go:336 +0x8e
main.(*initCommand).Run(0x166f380, 0xc42017d390, 0xc4200a0060, 0x0, 0x0, 0x0, 0x0)
	/Users/sheerun/go/src/github.com/golang/dep/cmd/dep/init.go:155 +0xf79
main.main()
	/Users/sheerun/go/src/github.com/golang/dep/cmd/dep/main.go:124 +0x6a3

@sdboyer
Copy link
Member

sdboyer commented Apr 10, 2017

@sheerun is the project you were working on when you encountered this panic public, so that I can replicate? While I'm pretty sure I know the problem here, it would be good to be certain.

@krisnova
Copy link
Contributor

+1 to replication steps - have heard about this a lot but have never had a good recipe to attempt to create it

@sheerun
Copy link

sheerun commented Apr 10, 2017

export GOPATH=$HOME/debug && go get -u github.com/golang/dep/... && go get -d github.com/ginuerzh/gost && cd $GOPATH/src/github.com/ginuerzh/gost/cmd/gost && dep init

@sdboyer
Copy link
Member

sdboyer commented Apr 10, 2017

cd $GOPATH/src/github.com/ginuerzh/gost/cmd/gost

This is likely at least part of the problem - see #193.

@timoreimann
Copy link

FWIW, I was about to comment on this issue and paste a log output of my own just before I realized I had messed up updating my previously installed copy of dep: I did go get -u github.com/golang/dep instead of go get -u github.com/golang/dep/cmd/dep. I guess this has caused dep to use an incompatible mixture of the main and sub-packages.

Not sure if the other reporters actually did the same mistake, but just in case I thought I'd share. :-)

@sdboyer
Copy link
Member

sdboyer commented Jul 25, 2017

i think this panic should be unreachable now - but it still exists because we only band-aid-ed over it, rather than fixing the underlying problem with the model.

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

No branches or pull requests

6 participants