[
https://issues.apache.org/jira/browse/THRIFT-5813?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Yuxuan Wang updated THRIFT-5813:
--------------------------------
Fix Version/s: 0.21.0
> Clarify TSocket state after isOpen
> ----------------------------------
>
> Key: THRIFT-5813
> URL: https://issues.apache.org/jira/browse/THRIFT-5813
> Project: Thrift
> Issue Type: Improvement
> Components: Python - Library
> Affects Versions: 0.20.0
> Reporter: Csaba Ringhofer
> Priority: Major
> Fix For: 0.21.0
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> Since 0.14.0 TSocket.py tries to peek into the socket during isOpen() and
> returns false if the connection seems to be disconnected (THRIFT-5248). The
> question is whether to close the socket in that case - currently isOpen()
> doesn't close the socket, while most clients probably expect it to be closed
> if isOpen() returned false.
> This makes it hard to create a "reopen if needed" logic that works both with
> THttpClient and TSocket:
> {code}
> if not transport.isOpen():
> transport.close()
> transport.open()
> {code}
> close() throws an exception in THttpClient, while calling it is needed for
> TSocket if isOpen() returned false due to the failing peek, otherwise open()
> will throw TTransportException.ALREADY_OPEN
> Found a ticket about the same issue in Go: THRIFT-5509
> The conclusion there was to close the socket during isOpen().
--
This message was sent by Atlassian Jira
(v8.20.10#820010)