[ https://issues.apache.org/jira/browse/THRIFT-5813?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17876247#comment-17876247 ]
Csaba Ringhofer commented on THRIFT-5813: ----------------------------------------- [~fishywang] yes, please assign the ticket to me Created a PR: https://github.com/apache/thrift/pull/3029 > 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 > Reporter: Csaba Ringhofer > Priority: Major > Time Spent: 10m > 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)