Ilya Morozov created THRIFT-5324: ------------------------------------ Summary: THttpClient sends previous message or partial message after http error Key: THRIFT-5324 URL: https://issues.apache.org/jira/browse/THRIFT-5324 Project: Thrift Issue Type: Bug Components: Go - Library Affects Versions: 0.13.0 Reporter: Ilya Morozov
We noticed that there's an "out of order sequence response" error immediately after an http error or premature context closure. We are seeing a lot of these in production. It seems like THttpClient does not reset it's internal buffer when http client returns an error, leaving the whole or partially read message in the buffer. On next call THttpClient sends the remains of previous message followed by current message, causing the server to execute it and return the previous seqId hence the "out of order sequence response" errors. Here's a small test of THttpClient that demonstrates this issue: [https://github.com/wheely/thrift/blob/c130f2452428540a4eefc4c422c8abc329ec837d/lib/go/thrift/http_client_test.go#L101-L147] . First write fails due to closed context, second write succeeds but writes both messages to the server. In current thrift version this test fails with: {code:java} http_client_test.go:144: Received unexpected data: write 1write 2{code} Please let me know if you need a better example. -- This message was sent by Atlassian Jira (v8.3.4#803005)