Csaba Ringhofer created THRIFT-5813:
---------------------------------------

             Summary: 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


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)

Reply via email to