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

Caddy exits with 'panic: runtime error: invalid memory address or nil pointer dereference' #3627

Closed
lowercasename opened this issue Aug 2, 2020 · 5 comments
Labels
invalid ❓ This doesn't seem right

Comments

@lowercasename
Copy link

lowercasename commented Aug 2, 2020

Caddy 2 has been running flawlessly on my server for a few months, serving about 10 websites. A few hours ago it exited with the following output (apologies for the screenshot, I don't have access to a text console at the moment):

Screenshot 2020-08-02 at 19 43 17

For searching, the relevant output is:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x2d8 pc=0x8be0e1]
goroutine 778762 [running]:
github.com/caddyserver/certmagic.(*Cache).updateOCSPStaples
[...]
github.com/caddyserver/certmagic.(*Cache).maintainAssets
[...]
github.com/caddyserver/certmagic.NewCache
[...]
caddy.service: Main process exited, code=exited, status=2/INVALIDARGUMENT

The server is running Ubuntu 20.04, and I installed Caddy from the Ubuntu package.

I restarted the service and it's working absolutely fine now, so it seems like it was a once-off, but I'd like to prevent it from happening again!

@mholt
Copy link
Member

mholt commented Aug 2, 2020

Which version are you running? I think this was fixed a while ago. I'll need the exact version in order to look up the stack trace.

@mholt mholt added the needs info 📭 Requires more information label Aug 2, 2020
@mholt
Copy link
Member

mholt commented Aug 2, 2020

I just had a great idea, we should be printing the Caddy version in the logs (pictured above)!

@lowercasename
Copy link
Author

Ah, good catch, caddy was being held back from updating for some reason! I was running 2.0.0! Now updated to 2.1.1.

@francislavoie francislavoie added invalid ❓ This doesn't seem right and removed needs info 📭 Requires more information labels Aug 3, 2020
@francislavoie
Copy link
Member

francislavoie commented Aug 3, 2020

Thanks for confirming, I'll close this now.

I figure @mholt doesn't need this issue open to remind him to add that extra log line 😅

@mholt
Copy link
Member

mholt commented Aug 3, 2020

Yeah, thanks, simple enough: 68529e2

And the bug was fixed upstream back in May: caddyserver/certmagic@5ed3640#diff-52c596c82713259b4527325d2a6c2846 - first by fixing the actual cause of the panic, then adding recover() everywhere so that even if there are other crashes it won't cause the server to go down. So this can't happen again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid ❓ This doesn't seem right
Projects
None yet
Development

No branches or pull requests

3 participants