[ https://issues.apache.org/jira/browse/THRIFT-5092?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17036003#comment-17036003 ]
Jens Geyer commented on THRIFT-5092: ------------------------------------ We love patches :-) http://thrift.apache.org/docs/HowToContribute > Panic on nil buffer writes > -------------------------- > > Key: THRIFT-5092 > URL: https://issues.apache.org/jira/browse/THRIFT-5092 > Project: Thrift > Issue Type: Bug > Components: Go - Library > Affects Versions: 0.13.0 > Reporter: Renan DelValle > Priority: Major > > Whenever a buffer from a THttpClient is set to nil, any subsequent attempts > to write to the connection will result in a panic. > Regardless of how the buffer ended up in a nil state, it is a better approach > to handle the error in the call to the Write than to have the program panic. > We've been hitting this issue once in a while and it's been difficult to > replicate but here is some sanitized relevant stack trace: > > {code:java} > panic(0x1446380, 0x1fcff90) > /usr/local/go/src/runtime/panic.go:491 +0x283 > bytes.(*Buffer).Write(0x0, 0xc42143b000, 0x87, 0x1000, 0x1, 0x0, 0x0) > /usr/local/go/src/bytes/buffer.go:160 +0x26 > > github.company.com/project/internal-project-prod/vendor/github.com/apache/thrift/lib/go/thrift.(*THttpClient).Write(0xc421418b00, > 0xc42143b000, 0x87, 0x1000, 0xc421018538, 0x9195a8, 0xc42085ae10) > > /go/src/github.company.com/project/internal-project-prod/vendor/github.com/apache/thrift/lib/go/thrift/http_client.go:173 > +0x4d > bufio.(*Writer).Flush(0xc421418b80, 0x90f42e, 0xc42085ae10) > /usr/local/go/src/bufio/bufio.go:567 +0x7e > > github.company.com/project/internal-project-prod/vendor/github.com/apache/thrift/lib/go/thrift.(*TJSONProtocol).Flush(0xc4203562d0, > 0x1f8d4c0, 0xc420016088, 0x0, 0x0) > > /go/src/github.company.com/project/internal-project-prod/vendor/github.com/apache/thrift/lib/go/thrift/json_protocol.go:440 > +0x36 > > github.company.com/project/internal-project-prod/vendor/github.com/apache/thrift/lib/go/thrift.(*TStandardClient).Send(0xc420e55020, > 0x1f8d4c0, 0xc420016088, 0x1f9b720, 0xc4203562d0, 0x11, 0x1655325, 0xe, > 0x1f7f500, 0xc420360020, ...) > {code} > followed by the root cause of the panic: > {code:java} > runtime error: invalid memory address or nil pointer dereference > {code} > I have a patch I'm testing out. I would love some feedback on it. > [https://github.com/apache/thrift/compare/master...ridv:0.12.0] > -- This message was sent by Atlassian Jira (v8.3.4#803005)