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

Crash in DMap Get after cluster node restarts #61

Closed
cobexer opened this issue Oct 8, 2020 · 1 comment
Closed

Crash in DMap Get after cluster node restarts #61

cobexer opened this issue Oct 8, 2020 · 1 comment
Assignees
Labels
bug Something isn't working dmap release-blocker
Milestone

Comments

@cobexer
Copy link

cobexer commented Oct 8, 2020

http: panic serving 127.0.0.1:43120: runtime error: invalid memory address or nil pointer dereference
goroutine 354448 [running]:
net/http.(*conn).serve.func1(0xc00013e000)
	/usr/local/go/src/net/http/server.go:1801 +0x147
panic(0x2482ea0, 0x3f77bb0)
	/usr/local/go/src/runtime/panic.go:975 +0x3e9
github.com/buraksezer/olric/internal/protocol.(*DMapMessage).SetBuffer(0x0, 0xc005a6dc50)
	/go/pkg/mod/github.com/buraksezer/olric@v0.3.0-beta.4/internal/protocol/dmap.go:128 +0x20
github.com/buraksezer/olric/internal/transport.(*Client).RequestTo(0xc0000d0a00, 0xc00247bbe0, 0x12, 0x2dd63a0, 0x0, 0x0, 0x0, 0x0, 0x0)
	/go/pkg/mod/github.com/buraksezer/olric@v0.3.0-beta.4/internal/transport/client.go:236 +0x174
github.com/buraksezer/olric.(*Olric).requestTo(0xc0004ad8c0, 0xc00247bbe0, 0x12, 0x2dd63a0, 0x0, 0x4, 0x2, 0x97, 0xc005de62c0)
	/go/pkg/mod/github.com/buraksezer/olric@v0.3.0-beta.4/olric.go:465 +0x6a
github.com/buraksezer/olric.(*Olric).readRepair(0xc0004ad8c0, 0x29cdf9c, 0x7, 0xc000765230, 0xc006acf700, 0xc001dc5080, 0x2, 0x2)
	/go/pkg/mod/github.com/buraksezer/olric@v0.3.0-beta.4/dmap_get.go:208 +0x408
github.com/buraksezer/olric.(*Olric).callGetOnCluster(0xc0004ad8c0, 0xb996eaeb6dea11fb, 0x29cdf9c, 0x7, 0xc005002dc0, 0x48, 0x10, 0x3fe9df4bb343ca0c, 0x163bfafaf7a57943, 0xb996eaeb6dea11fb, ...)
	/go/pkg/mod/github.com/buraksezer/olric@v0.3.0-beta.4/dmap_get.go:263 +0x458
github.com/buraksezer/olric.(*Olric).get(0xc0004ad8c0, 0x29cdf9c, 0x7, 0xc005002dc0, 0x48, 0x0, 0xc002121080, 0x58, 0xc002121088, 0xc00500e00c)
	/go/pkg/mod/github.com/buraksezer/olric@v0.3.0-beta.4/dmap_get.go:272 +0x267
github.com/buraksezer/olric.(*DMap).Get(0xc0006b65c0, 0xc005002dc0, 0x48, 0x9, 0xc002121108, 0x0, 0x7)
	/go/pkg/mod/github.com/buraksezer/olric@v0.3.0-beta.4/dmap_get.go:291 +0x58
example.com/container-id-to-image-cache/internal/kvcache.(*KVCache).Get(...)
	/build/internal/kvcache/kvcache.go:112
example.com/container-id-to-image-cache/internal/rest.(*API).handleLookup.func1(0x2dae280, 0xc002c6f040, 0xc00500c000)
	/build/internal/rest/restapi.go:65 +0x93
net/http.HandlerFunc.ServeHTTP(0xc000734a80, 0x2dae280, 0xc002c6f040, 0xc00500c000)
	/usr/local/go/src/net/http/server.go:2042 +0x44
net/http.(*ServeMux).ServeHTTP(0x3fb20c0, 0x2dae280, 0xc002c6f040, 0xc00500c000)
	/usr/local/go/src/net/http/server.go:2417 +0x1ad
github.com/gorilla/handlers.loggingHandler.ServeHTTP(0x2d66560, 0xc00000e018, 0x2d66200, 0x3fb20c0, 0x2acdcd0, 0x2dacdc0, 0xc000d8a2a0, 0xc00500c000)
	/go/pkg/mod/github.com/gorilla/handlers@v1.5.1/logging.go:47 +0xe6
github.com/gorilla/handlers.ProxyHeaders.func1(0x2dacdc0, 0xc000d8a2a0, 0xc00500c000)
	/go/pkg/mod/github.com/gorilla/handlers@v1.5.1/proxy_headers.go:59 +0x114
net/http.HandlerFunc.ServeHTTP(0xc00072b8c0, 0x2dacdc0, 0xc000d8a2a0, 0xc00500c000)
	/usr/local/go/src/net/http/server.go:2042 +0x44
net/http.serverHandler.ServeHTTP(0xc000648000, 0x2dacdc0, 0xc000d8a2a0, 0xc00500c000)
	/usr/local/go/src/net/http/server.go:2843 +0xa3
net/http.(*conn).serve(0xc00013e000, 0x2db2ac0, 0xc002c1f540)
	/usr/local/go/src/net/http/server.go:1925 +0x8ad
created by net/http.(*Server).Serve
	/usr/local/go/src/net/http/server.go:2969 +0x36c

If I checked this correctly this is because of:

req := protocol.NewDMapMessage(protocol.OpPutExReplica)
which uses req := instead of just req = and thus passes a nil req into db.requestTo causing the crash.

@buraksezer
Copy link
Owner

Fixed in 63c6d11

Please feel free to reopen this issue, if you encounter the problem again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dmap release-blocker
Projects
None yet
Development

No branches or pull requests

2 participants