Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic in gateway trying to access raw leaf node #3399

Closed
Kubuxu opened this issue Nov 20, 2016 · 2 comments · Fixed by #3403
Closed

Panic in gateway trying to access raw leaf node #3399

Kubuxu opened this issue Nov 20, 2016 · 2 comments · Fixed by #3403
Assignees
Labels
kind/bug A bug in existing code (including security flaws) topic/gateway Topic gateway

Comments

@Kubuxu
Copy link
Member

Kubuxu commented Nov 20, 2016

runtime error: invalid memory address or nil pointer dereference gateway_handler.go:81
goroutine 2784 [running]:
runtime/debug.Stack(0x40, 0xc4228130a8, 0x6505f7)
	/usr/lib/go/src/runtime/debug/stack.go:24 +0x79
runtime/debug.PrintStack()
	/usr/lib/go/src/runtime/debug/stack.go:16 +0x22
github.com/ipfs/go-ipfs/core/corehttp.(*gatewayHandler).ServeHTTP.func2()
	/home/kubuxu/AUR/go-ipfs-git/src/src/github.com/ipfs/go-ipfs/core/corehttp/gateway_handler.go:82 +0x160
panic(0xc01020, 0xc420010140)
	/usr/lib/go/src/runtime/panic.go:458 +0x243
github.com/ipfs/go-ipfs/unixfs/io.(*DagReader).Close(0xc422463650, 0xc422ea6284, 0x37)
	/home/kubuxu/AUR/go-ipfs-git/src/src/github.com/ipfs/go-ipfs/unixfs/io/dagreader.go:230 +0x18
panic(0xc01020, 0xc420010140)
	/usr/lib/go/src/runtime/panic.go:458 +0x243
github.com/ipfs/go-ipfs/unixfs/io.(*DagReader).Seek(0xc422463650, 0x0, 0x0, 0xd009b2, 0x19, 0x4)
	/home/kubuxu/AUR/go-ipfs-git/src/src/github.com/ipfs/go-ipfs/unixfs/io/dagreader.go:254 +0x62
net/http.serveContent(0x1138660, 0xc4201122d0, 0xc421eb3860, 0xc422ea628a, 0x31, 0xe7791f701, 0xc400000000, 0x121e380, 0xc422f096a0, 0x7fb438b7e540, ...)
	/usr/lib/go/src/net/http/fs.go:169 +0xc84
net/http.ServeContent(0x1138660, 0xc4201122d0, 0xc421eb3860, 0xc422ea628a, 0x31, 0xe7791f701, 0x0, 0x121e380, 0x7fb438b7e540, 0xc422463650)
	/usr/lib/go/src/net/http/fs.go:134 +0xde
github.com/ipfs/go-ipfs/core/corehttp.(*gatewayHandler).getOrHeadHandler(0xc42204ac40, 0x113a560, 0xc422f58300, 0x1138660, 0xc4201122d0, 0xc421eb3860)
	/home/kubuxu/AUR/go-ipfs-git/src/src/github.com/ipfs/go-ipfs/core/corehttp/gateway_handler.go:230 +0x146c
github.com/ipfs/go-ipfs/core/corehttp.(*gatewayHandler).ServeHTTP(0xc42204ac40, 0x1138660, 0xc4201122d0, 0xc421eb3860)
	/home/kubuxu/AUR/go-ipfs-git/src/src/github.com/ipfs/go-ipfs/core/corehttp/gateway_handler.go:101 +0x5d2
net/http.(*ServeMux).ServeHTTP(0xc4222883c0, 0x1138660, 0xc4201122d0, 0xc421eb3860)
	/usr/lib/go/src/net/http/server.go:2022 +0x7f
github.com/ipfs/go-ipfs/core/corehttp.IPNSHostnameOption.func1.1(0x1138660, 0xc4201122d0, 0xc421eb3860)
	/home/kubuxu/AUR/go-ipfs-git/src/src/github.com/ipfs/go-ipfs/core/corehttp/ipns_hostname.go:31 +0x142
net/http.HandlerFunc.ServeHTTP(0xc42204dca0, 0x1138660, 0xc4201122d0, 0xc421eb3860)
	/usr/lib/go/src/net/http/server.go:1726 +0x44
net/http.(*ServeMux).ServeHTTP(0xc421fff830, 0x1138660, 0xc4201122d0, 0xc421eb3860)
	/usr/lib/go/src/net/http/server.go:2022 +0x7f
net/http.(Handler).ServeHTTP-fm(0x1138660, 0xc4201122d0, 0xc421eb3860)
	/usr/lib/go/src/net/http/h2_bundle.go:4084 +0x4d
gx/ipfs/QmR3KwhXCRLTNZB59vELb2HhEWrGy9nuychepxFtj3wWYa/client_golang/prometheus.InstrumentHandlerFuncWithOpts.func1(0x11396e0, 0xc422f7e1a0, 0xc421eb3860)
	/home/kubuxu/AUR/go-ipfs-git/src/src/gx/ipfs/QmR3KwhXCRLTNZB59vELb2HhEWrGy9nuychepxFtj3wWYa/client_golang/prometheus/http.go:287 +0x2ab
net/http.HandlerFunc.ServeHTTP(0xc4220503c0, 0x11396e0, 0xc422f7e1a0, 0xc421eb3860)
	/usr/lib/go/src/net/http/server.go:1726 +0x44
net/http.(*ServeMux).ServeHTTP(0xc421fff800, 0x11396e0, 0xc422f7e1a0, 0xc421eb3860)
	/usr/lib/go/src/net/http/server.go:2022 +0x7f
net/http.serverHandler.ServeHTTP(0xc422007e00, 0x11396e0, 0xc422f7e1a0, 0xc421eb3860)
	/usr/lib/go/src/net/http/server.go:2202 +0x7d
net/http.(*conn).serve(0xc422e34680, 0x113a4e0, 0xc422f31ac0)
	/usr/lib/go/src/net/http/server.go:1579 +0x4b7
created by net/http.(*Server).Serve
	/usr/lib/go/src/net/http/server.go:2293 +0x44d

Replicate

 echo dcf | ipfs add --raw-leaves               
added zdvgqGt3bciGPAzEbMDDqZKPmJxjCANeRwZUQWHb5hsXgw7Ba zdvgqGt3bciGPAzEbMDDqZKPmJxjCANeRwZUQWHb5hsXgw7Ba
 curl -s localhost:8081/ipfs/zdvgqGt3bciGPAzEbMDDqZKPmJxjCANeRwZUQWHb5hsXgw7Ba

@Kubuxu Kubuxu added kind/bug A bug in existing code (including security flaws) topic/gateway Topic gateway labels Nov 20, 2016
@Kubuxu Kubuxu added this to the ipld integration milestone Nov 20, 2016
@Kubuxu Kubuxu changed the title Panic in gateway tryiung to access raw leaf node Panic in gateway trying to access raw leaf node Nov 20, 2016
@Kubuxu Kubuxu added the status/ready Ready to be worked label Nov 20, 2016
@Kubuxu
Copy link
Member Author

Kubuxu commented Nov 21, 2016

Problem is that dagreader is currently very coupled to pbnodes and when it tires to seek over raw nodes it misses data.

I think it will be best to create DagReader interface and have multiple implementation and central method that would create implementation depending on node type.

@Kubuxu
Copy link
Member Author

Kubuxu commented Nov 21, 2016

Hmm, those two formats are too coupled with each other.

@Kubuxu Kubuxu self-assigned this Nov 21, 2016
@Kubuxu Kubuxu added status/in-progress In progress and removed status/ready Ready to be worked labels Nov 21, 2016
@whyrusleeping whyrusleeping removed the status/in-progress In progress label Nov 22, 2016
@ajnavarro ajnavarro mentioned this issue Aug 24, 2022
72 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug in existing code (including security flaws) topic/gateway Topic gateway
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants