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 Crashing Due To Nil Pointer Dereference #5347
Comments
Hmm... it looks like happened within a relatively new piece of code which handles caddy/modules/caddyhttp/reverseproxy/reverseproxy.go Lines 777 to 795 in 6bad878
@dunglas do you have any clues as to the issue? @Rishi556 do you know whether your backends might be using |
The backend is a haproxy 2.6.8 server(updated to 2.7.2 about 5 minutes ago) which points to a few stateless JSONRPC2 servers, and I don't think those support early hints. The only part that might have early hints configured is the /stats endpoint which leads to the haproxy stats page. I'm checking there to see if early hints is used anywhere. |
Bizarre: https://cs.opensource.google/go/go/+/refs/tags/go1.19.5:src/net/http/server.go;l=1165 and Like the buffer of the connection is nil? How is that even possible? Maybe it's a bug in our code, but I wonder if there could be a very unlikely bug in Go std lib. |
I've enabled request logging and once I see another crash, I'll pass the logs back here. |
From the log it appears to be a bug with stdlib. Maybe a corner case in net/http/transport |
I remember once I also encountered this bug, that's about at least 2 years before. Way before 103 is introduced. |
@Rishi556 Does your backend involve websockets? |
The backend does have support for websockets, but I verified that they are disabled. Doesn't stop a client from attempting to connect via them though. I made a few connection attempts and they didn't cause any crashes. There also has been no crashes after this issue was created. |
We also (very rarely) encounter this issue with Mercure (Websocket is not used), here is the detailed stack trace:
The error we get is the same #3713 (so it looks like the bug is not related to 103 Early Hints). |
It appears from the stack trace it's a problem with Mercure plug-in. Using a response writer after its handler already returned. I'm not using a computer now so I can't say for sure. |
@dunglas I created a patch for your plugin. That issues doesn't have anything to with the error this issue described. |
Thank you very much, and sorry for the false report. |
Just an update from my side, it hadn’t crashed again since I’ve enabled request logging. Still waiting to see if it will though. |
@WeidiDeng You're awesome. Thank you so much for doing that. @dunglas You rock too, we're glad for your contributions to the community!! |
I assume this is working alright now with the patch upstream, so I'll close this. Thanks everyone! |
On a production server, getting the following error:
The config being used is:
The
reverse_proxy 0.0.0.0:3000
part uses a different ip, and was replaced for 0.0.0.0 while sharing to hide sensitive info.This has worked without issues for multiple months until today when crashes started. A simple restart fixes the issue and gets the application working.
The text was updated successfully, but these errors were encountered: