[
https://issues.apache.org/jira/browse/THRIFT-2488?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18115806#comment-18115806
]
Sylwester Lachiewicz commented on THRIFT-2488:
----------------------------------------------
Still true in principle on master. {{TSocket.Read}} sets a deadline per read
and returns the error without closing the connection, and
{{TStandardClient.Recv}} now checks the sequence id
([client.go:64|https://github.com/apache/thrift/blob/master/lib/go/thrift/client.go#L64])
and returns BAD_SEQUENCE_ID, so reuse after a timeout fails cleanly instead of
misparsing. The transport is still left open for the caller. Closing it on a
timeout inside TStandardClient would resolve this; that is a behaviour change,
so raising it here before any code.
_This comment was created with AI assistance._
> Timeouts can leave client in unrecoverable state
> ------------------------------------------------
>
> Key: THRIFT-2488
> URL: https://issues.apache.org/jira/browse/THRIFT-2488
> Project: Thrift
> Issue Type: Bug
> Components: Go - Library
> Affects Versions: 0.9.1
> Reporter: Chris Bannister
> Priority: Major
> Attachments: testcase.go, timeout.thrift
>
>
> If you set the timeout on a TSocket and experience a timeout the client will
> stop reading the struct and return the error as expected.
> But if you use the TSocket again after the remote system has sent the
> timedout data and the client has received it the client will be unusable
> because it ends up in a state with incorrect sequence-ids and unexpected data
> in its buffer.
> This means that the TSocket should be closed if there is any network level
> error when reading/writing.
> This can also be fixed by making more attempts to read/write when the error
> is a net.Error and err.Temporary() is true. Could also do something where the
> client is persistently reading from the socket and discards out of order
> messages or handle out of order sequences.
> Test case to show the failures attached
--
This message was sent by Atlassian Jira
(v8.20.10#820010)