Bad error handling in rushlink.renderStatic #60

Closed
opened 2020-05-28 12:31:50 +02:00 by mrngm · 1 comment
Collaborator
May 28 08:50:59 koulourakia rushlink[382]: 2020/05/28 08:50:59 error: runtime error: invalid memory address or nil pointer dereference                                                                             
May 28 08:50:59 koulourakia rushlink[382]: goroutine 127248 [running]:
May 28 08:50:59 koulourakia rushlink[382]: runtime/debug.Stack(0xc0000200f0, 0x2, 0xc000026e10)
May 28 08:50:59 koulourakia rushlink[382]:         /usr/lib/go-1.14/src/runtime/debug/stack.go:24 +0x9d
May 28 08:50:59 koulourakia rushlink[382]: runtime/debug.PrintStack()
May 28 08:50:59 koulourakia rushlink[382]:         /usr/lib/go-1.14/src/runtime/debug/stack.go:16 +0x22
May 28 08:50:59 koulourakia rushlink[382]: gitea.hashru.nl/dsprenkels/rushlink.(*rushlink).recoveryMiddleware.func1.1(0x9f46a0, 0xc0000e2700, 0xc00009a600, 0xc000299a00)                                          
May 28 08:50:59 koulourakia rushlink[382]:         /root/go/src/gitea.hashru.nl/dsprenkels/rushlink/router.go:44 +0xfb                                                                                             
May 28 08:50:59 koulourakia rushlink[382]: panic(0x8b3e60, 0xd3ab30)
May 28 08:50:59 koulourakia rushlink[382]:         /usr/lib/go-1.14/src/runtime/panic.go:969 +0x166
May 28 08:50:59 koulourakia rushlink[382]: gitea.hashru.nl/dsprenkels/rushlink.(*rushlink).renderStatic(0xc00009a600, 0x9f3f20, 0xc0003efa60, 0xc000299a00, 0xc000340425, 0x17)                                    
May 28 08:50:59 koulourakia rushlink[382]:         /root/go/src/gitea.hashru.nl/dsprenkels/rushlink/views.go:92 +0x2e8                                                                                             
May 28 08:50:59 koulourakia rushlink[382]: gitea.hashru.nl/dsprenkels/rushlink.(*rushlink).staticGetHandler(0xc00009a600, 0x9f3f20, 0xc0003efa60, 0xc000299a00)                                                    
May 28 08:50:59 koulourakia rushlink[382]:         /root/go/src/gitea.hashru.nl/dsprenkels/rushlink/handlers.go:57 +0x96                                                                                           
May 28 08:50:59 koulourakia rushlink[382]: net/http.HandlerFunc.ServeHTTP(0xc00009e8e0, 0x9f3f20, 0xc0003efa60, 0xc000299a00)                                                                                      
May 28 08:50:59 koulourakia rushlink[382]:         /usr/lib/go-1.14/src/net/http/server.go:2012 +0x44
May 28 08:50:59 koulourakia rushlink[382]: gitea.hashru.nl/dsprenkels/rushlink.(*rushlink).metricsMiddleware.func1(0x9f46a0, 0xc0000e2700, 0xc000299a00)                                                           
May 28 08:50:59 koulourakia rushlink[382]:         /root/go/src/gitea.hashru.nl/dsprenkels/rushlink/router.go:55 +0xa2                                                                                             
May 28 08:50:59 koulourakia rushlink[382]: net/http.HandlerFunc.ServeHTTP(0xc0003efa20, 0x9f46a0, 0xc0000e2700, 0xc000299a00)                                                                                      
May 28 08:50:59 koulourakia rushlink[382]:         /usr/lib/go-1.14/src/net/http/server.go:2012 +0x44
May 28 08:50:59 koulourakia rushlink[382]: gitea.hashru.nl/dsprenkels/rushlink.(*rushlink).recoveryMiddleware.func1(0x9f46a0, 0xc0000e2700, 0xc000299a00)                                                          
May 28 08:50:59 koulourakia rushlink[382]:         /root/go/src/gitea.hashru.nl/dsprenkels/rushlink/router.go:48 +0x91                                                                                             
May 28 08:50:59 koulourakia rushlink[382]: net/http.HandlerFunc.ServeHTTP(0xc0003efa40, 0x9f46a0, 0xc0000e2700, 0xc000299a00)                                                                                      
May 28 08:50:59 koulourakia rushlink[382]:         /usr/lib/go-1.14/src/net/http/server.go:2012 +0x44
May 28 08:50:59 koulourakia rushlink[382]: github.com/gorilla/mux.(*Router).ServeHTTP(0xc00031c000, 0x9f46a0, 0xc0000e2700, 0xc000299700)                                                                          
May 28 08:50:59 koulourakia rushlink[382]:         /root/go/pkg/mod/github.com/gorilla/mux@v1.7.4/mux.go:210 +0xe2                                                                                                 
May 28 08:50:59 koulourakia rushlink[382]: net/http.serverHandler.ServeHTTP(0xc000312a80, 0x9f46a0, 0xc0000e2700, 0xc000299700)                                                                                    
May 28 08:50:59 koulourakia rushlink[382]:         /usr/lib/go-1.14/src/net/http/server.go:2807 +0xa3
May 28 08:50:59 koulourakia rushlink[382]: net/http.(*conn).serve(0xc00011f180, 0x9f5d20, 0xc00018e8c0)
May 28 08:50:59 koulourakia rushlink[382]:         /usr/lib/go-1.14/src/net/http/server.go:1895 +0x86c
May 28 08:50:59 koulourakia rushlink[382]: created by net/http.(*Server).Serve
May 28 08:50:59 koulourakia rushlink[382]:         /usr/lib/go-1.14/src/net/http/server.go:2933 +0x35c
``` May 28 08:50:59 koulourakia rushlink[382]: 2020/05/28 08:50:59 error: runtime error: invalid memory address or nil pointer dereference May 28 08:50:59 koulourakia rushlink[382]: goroutine 127248 [running]: May 28 08:50:59 koulourakia rushlink[382]: runtime/debug.Stack(0xc0000200f0, 0x2, 0xc000026e10) May 28 08:50:59 koulourakia rushlink[382]: /usr/lib/go-1.14/src/runtime/debug/stack.go:24 +0x9d May 28 08:50:59 koulourakia rushlink[382]: runtime/debug.PrintStack() May 28 08:50:59 koulourakia rushlink[382]: /usr/lib/go-1.14/src/runtime/debug/stack.go:16 +0x22 May 28 08:50:59 koulourakia rushlink[382]: gitea.hashru.nl/dsprenkels/rushlink.(*rushlink).recoveryMiddleware.func1.1(0x9f46a0, 0xc0000e2700, 0xc00009a600, 0xc000299a00) May 28 08:50:59 koulourakia rushlink[382]: /root/go/src/gitea.hashru.nl/dsprenkels/rushlink/router.go:44 +0xfb May 28 08:50:59 koulourakia rushlink[382]: panic(0x8b3e60, 0xd3ab30) May 28 08:50:59 koulourakia rushlink[382]: /usr/lib/go-1.14/src/runtime/panic.go:969 +0x166 May 28 08:50:59 koulourakia rushlink[382]: gitea.hashru.nl/dsprenkels/rushlink.(*rushlink).renderStatic(0xc00009a600, 0x9f3f20, 0xc0003efa60, 0xc000299a00, 0xc000340425, 0x17) May 28 08:50:59 koulourakia rushlink[382]: /root/go/src/gitea.hashru.nl/dsprenkels/rushlink/views.go:92 +0x2e8 May 28 08:50:59 koulourakia rushlink[382]: gitea.hashru.nl/dsprenkels/rushlink.(*rushlink).staticGetHandler(0xc00009a600, 0x9f3f20, 0xc0003efa60, 0xc000299a00) May 28 08:50:59 koulourakia rushlink[382]: /root/go/src/gitea.hashru.nl/dsprenkels/rushlink/handlers.go:57 +0x96 May 28 08:50:59 koulourakia rushlink[382]: net/http.HandlerFunc.ServeHTTP(0xc00009e8e0, 0x9f3f20, 0xc0003efa60, 0xc000299a00) May 28 08:50:59 koulourakia rushlink[382]: /usr/lib/go-1.14/src/net/http/server.go:2012 +0x44 May 28 08:50:59 koulourakia rushlink[382]: gitea.hashru.nl/dsprenkels/rushlink.(*rushlink).metricsMiddleware.func1(0x9f46a0, 0xc0000e2700, 0xc000299a00) May 28 08:50:59 koulourakia rushlink[382]: /root/go/src/gitea.hashru.nl/dsprenkels/rushlink/router.go:55 +0xa2 May 28 08:50:59 koulourakia rushlink[382]: net/http.HandlerFunc.ServeHTTP(0xc0003efa20, 0x9f46a0, 0xc0000e2700, 0xc000299a00) May 28 08:50:59 koulourakia rushlink[382]: /usr/lib/go-1.14/src/net/http/server.go:2012 +0x44 May 28 08:50:59 koulourakia rushlink[382]: gitea.hashru.nl/dsprenkels/rushlink.(*rushlink).recoveryMiddleware.func1(0x9f46a0, 0xc0000e2700, 0xc000299a00) May 28 08:50:59 koulourakia rushlink[382]: /root/go/src/gitea.hashru.nl/dsprenkels/rushlink/router.go:48 +0x91 May 28 08:50:59 koulourakia rushlink[382]: net/http.HandlerFunc.ServeHTTP(0xc0003efa40, 0x9f46a0, 0xc0000e2700, 0xc000299a00) May 28 08:50:59 koulourakia rushlink[382]: /usr/lib/go-1.14/src/net/http/server.go:2012 +0x44 May 28 08:50:59 koulourakia rushlink[382]: github.com/gorilla/mux.(*Router).ServeHTTP(0xc00031c000, 0x9f46a0, 0xc0000e2700, 0xc000299700) May 28 08:50:59 koulourakia rushlink[382]: /root/go/pkg/mod/github.com/gorilla/mux@v1.7.4/mux.go:210 +0xe2 May 28 08:50:59 koulourakia rushlink[382]: net/http.serverHandler.ServeHTTP(0xc000312a80, 0x9f46a0, 0xc0000e2700, 0xc000299700) May 28 08:50:59 koulourakia rushlink[382]: /usr/lib/go-1.14/src/net/http/server.go:2807 +0xa3 May 28 08:50:59 koulourakia rushlink[382]: net/http.(*conn).serve(0xc00011f180, 0x9f5d20, 0xc00018e8c0) May 28 08:50:59 koulourakia rushlink[382]: /usr/lib/go-1.14/src/net/http/server.go:1895 +0x86c May 28 08:50:59 koulourakia rushlink[382]: created by net/http.(*Server).Serve May 28 08:50:59 koulourakia rushlink[382]: /usr/lib/go-1.14/src/net/http/server.go:2933 +0x35c ```
Owner

Most likely cause, this error handling is wrong: 5a5a0dc5ec/views.go (L91-L93)

Most likely cause, this error handling is wrong: https://gitea.hashru.nl/dsprenkels/rushlink/src/commit/5a5a0dc5ece2ec6a0830fae23e9df84eca64dfe0/views.go#L91-L93
electricdusk added the
bug
label 2020-05-28 12:39:20 +02:00
electricdusk changed title from nil pointer deref to Bad error handling in rushlink.renderStatic 2020-05-28 12:39:43 +02:00
electricdusk added the
needs-test
label 2020-05-28 12:46:03 +02:00
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: electricdusk/rushlink#60
No description provided.