-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Fixes crash if logging error is not HandlerError #6777
Conversation
Do you have more information? What is the crash? (Full or nearly the full output please) |
I ran into this when using the reverse proxy programmatically with a cancel context ie. On a related note, is there a reason to not copy the original request context in reverseproxy.go Probably not many ways to get here otherwise, but was pretty difficult to track this thought i'd spare the next person's night of sleep |
Thanks; but what's the crash exactly? I just want to make sure I understand what is broken and what this fixes. I know you say the stack trace gets corrupted, but I'm not sure how that happens with a Go program. What's the output you see?
I think because the request could potentially be used in a goroutine and the request context is not thread-safe. |
i got it to panic cleanly this time with curl:
|
why is the request's context not thread safe? from go docs, it should be used instead of Cancel channels with RoundTripper across routines
|
I think it's more that the specific use of context by various Caddy modules may not be thread safe -- I seem to recall vaguely some issue there years ago, that we since overcame, but it can be something to consider. Thanks! |
Fixes a crash at caddy/modules/caddyhttp/server.go:394