Skip to content
This repository was 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