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

nil pointer dereference #12

Closed
eckyputrady opened this issue Jul 8, 2023 · 0 comments
Closed

nil pointer dereference #12

eckyputrady opened this issue Jul 8, 2023 · 0 comments

Comments

@eckyputrady
Copy link

I'm simulating traffic of 5 concurrent users, and the server consistently throws this error after a while, and subsequent requests will return 500 ERROR.

I run the production build.

Just letting you know 🙂

2023/07/08 16:08:39 [Recovery] 2023/07/08 - 16:08:39 panic recovered:
GET /api/articles/lglnqbloiq-qv5xm3z40xzp/comments? HTTP/1.1
Host: localhost:8085
Authorization: *


runtime error: invalid memory address or nil pointer dereference
/usr/local/Cellar/go/1.20.5/libexec/src/runtime/panic.go:260 (0x104ae7c)
	panicmem: panic(memoryError)
/usr/local/Cellar/go/1.20.5/libexec/src/runtime/signal_unix.go:841 (0x104ae4c)
	sigpanic: panicmem()
/Users/ecky/Projects/realworld-gin-sqlc/api/article_handler.go:872 (0x18473dc)
	(*Server).GetComments: authorIDs = append(authorIDs, *comment.AuthorID)
/Users/ecky/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174 (0x154d761)
	(*Context).Next: c.handlers[c.index](c)
/Users/ecky/go/pkg/mod/github.com/gin-gonic/[email protected]/recovery.go:102 (0x154d74c)
	CustomRecoveryWithWriter.func1: c.Next()
/Users/ecky/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174 (0x154c886)
	(*Context).Next: c.handlers[c.index](c)
/Users/ecky/go/pkg/mod/github.com/gin-gonic/[email protected]/logger.go:240 (0x154c869)
	LoggerWithConfig.func1: c.Next()
/Users/ecky/go/pkg/mod/github.com/gin-gonic/[email protected]/context.go:174 (0x154b90a)
	(*Context).Next: c.handlers[c.index](c)
/Users/ecky/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:620 (0x154b591)
	(*Engine).handleHTTPRequest: c.Next()
/Users/ecky/go/pkg/mod/github.com/gin-gonic/[email protected]/gin.go:576 (0x154b0bc)
	(*Engine).ServeHTTP: engine.handleHTTPRequest(c)
/usr/local/Cellar/go/1.20.5/libexec/src/net/http/server.go:2936 (0x12f7475)
	serverHandler.ServeHTTP: handler.ServeHTTP(rw, req)
/usr/local/Cellar/go/1.20.5/libexec/src/net/http/server.go:1995 (0x12f2991)
	(*conn).serve: serverHandler{c.server}.ServeHTTP(w, w.req)
/usr/local/Cellar/go/1.20.5/libexec/src/runtime/asm_amd64.s:1598 (0x1067b60)
	goexit: BYTE	$0x90	// NOP

[GIN] 2023/07/08 - 16:08:39 | 500 |    2.475358ms |             ::1 | GET      "/api/articles/lglnqbloiq-qv5xm3z40xzp/comments"
@aliml92 aliml92 closed this as completed in 20ff31a Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant