-
Notifications
You must be signed in to change notification settings - Fork 40
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
bug: nil pointer dereference with Go 1.17.5 #154
Labels
Comments
@jsha, thank you for the issue and details! We saw that SIGSEGV in some of our internal Go services when we bumped to 1.17.5. This is on the queue to investigate further in libhoney. |
I have a fix, I'll put a PR up. |
PR is up. |
lizthegrey
changed the title
nil pointer dereference with Go 1.17.5
bug: nil pointer dereference with Go 1.17.5
Jan 4, 2022
Closed by #156 |
We're going to smoketest this within Honeycomb a few days; if you need the fix sooner, please run:
Thanks for the report! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In letsencrypt/boulder, we deployed a
build using Go 1.17.5 (upgrading from 1.17). Immediately we started getting panics from our web frontends like this:
libhoney is the only component in our frontends that makes outbound requests with
net/http
(we also use gRPC, but it has an internal h2 library).When we downgraded to Go 1.17, the panics went away. There are a number of http
related changes between Go 1.17 and Go 1.17.5:
golang/go@0177913
golang/go@ab17593
golang/go@f9cb33c
Looking at the stack trace, The most interesting bit is
bytes.(*Reader).Read
. Thenet/http
stack is callingRead()
on a*bytes.Reader
that is nil.In libhoney, traces are accumulated and then compressed with zstd. For pooling purposes, libhoney wraps a buffer in a
pooledReader
, which embeds a*bytes.Reader
. When the pooledReader gets a Close, it sets the embedded*bytes.Reader
to nil. So we know that any call to pooledReader.Read after pooledReader.Close will panic. It's not clear from the interface documentation of Reader and Closer whether such behavior is allowed.However, net/http's RoundTripper says:
Note that this says the request must not be reused until the Response's Body has been closed. I think the current implementation of pooledReader is violating that. I haven't been able to come up with a minimal repro of a case where net/http calls Read after Close, but the combination of things here makes me suspect an issue in libhoney-go.
One possible fix would be to provide a
.rePool()
function onpooledReader
, and call it explicitly afterhttpClient.Do(req)
returns.The text was updated successfully, but these errors were encountered: