Skip to content
This repository has been archived by the owner on Sep 20, 2022. It is now read-only.

Job runtime error messages should include a stack trace #25

Open
epelc opened this issue May 29, 2015 · 0 comments
Open

Job runtime error messages should include a stack trace #25

epelc opened this issue May 29, 2015 · 0 comments

Comments

@epelc
Copy link
Contributor

epelc commented May 29, 2015

If you have a job which panics the only error that's recorded is a short error message. However if it is a runtime error such as a nil pointer access or incorrect use of slices then this makes things very hard to debug because you do not have the stack trace. You end up with an error like the following in the redis hash for your job. Which is very vague in the case of runtime errors.

runtime error: invalid memory address or nil pointer dereference

I've found where this happens and I think the stack should either be logged or also sent to redis as the error message. But I'd be fine if it was just logged as this won't happen often.
https://github.com/albrow/jobs/blob/master/worker.go#L39

Here's an example of logging the stack incase you've never done this before. If you want more examples search for http recovery middlewares as they all have to do this.

stack := make([]byte, 1024*8)
stack = stack[:runtime.Stack(stack, false)]
log.Println("Panic stack:", err, string(stack))
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

2 participants