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
net/http: describe where multiple response.WriteHeader calls occur #18761
Comments
I can work on this if it is okay. Regarding the implementation, would it be okay to use runtime.Callers here, and find the first function whose name does not start with "net/http."? |
@siadat, sounds like it could work. As long as you only do that work when we're already spamming logs, and not for all WriteHeader calls. |
CL https://golang.org/cl/36096 mentions this issue. |
Hi @odeke-em, thanks for the reminder, I will have a look at it! |
Change https://golang.org/cl/130997 mentions this issue: |
I debugged quite a few of these in PHP in a previous life nearly a decade ago. From that experience I would like to mention that you usually don't know whether the first or the second one is the caller that should have been written the header. So I would suggest reporting both: The first writer and the second one. |
@nightlyone, that means making all users pay the cost of recording that first write's stack frame, even though the majority will only ever have one write. |
I see this in an HTTP server log:
Written by the http package here.
It would be nice if it described file+line of the first non-http package function that caused WriteHeader to be called so that it's easier to find the offending code.
\cc @bradfitz
The text was updated successfully, but these errors were encountered: