[
https://issues.apache.org/jira/browse/THRIFT-3737?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15192181#comment-15192181
]
ASF GitHub Bot commented on THRIFT-3737:
----------------------------------------
GitHub user cherrot opened a pull request:
https://github.com/apache/thrift/pull/945
THRIFT-3737 Improve isOpen() to give accurate tcp connection status.
Origin issue: https://issues.apache.org/jira/browse/THRIFT-3737
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/cherrot/thrift
THRIFT-3737.Accurate-connection-status
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/thrift/pull/945.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #945
----
commit c09968b5ca6e04893059e4799ec8e400b89392d1
Author: Cherrot Luo <[email protected]>
Date: 2016-03-13T07:39:05Z
Improve isOpen() to give accurate tcp connection status. (THRIFT-3737)
----
> Improve TSocket isOpen() implementation to give more accurate connection
> status.
> --------------------------------------------------------------------------------
>
> Key: THRIFT-3737
> URL: https://issues.apache.org/jira/browse/THRIFT-3737
> Project: Thrift
> Issue Type: Bug
> Components: Python - Library
> Reporter: Cherrot Luo
> Labels: patch
> Original Estimate: 0h
> Remaining Estimate: 0h
>
> h2. Description
> Typically isOpen() of TSocket.py in python lib would *ALWAYS* return true,
> even if the underlying TCP connection has been closed or reset by the peer,
> unless you manually invoke its close() method.
> This is because the isOpen method takes a simple but kind of "irresponsible"
> way to judge connection status:
> {code:title=TSocket.py}
> def isOpen(self):
> return self.handle is not None
> {code}
> This may affect the upstream lib/tools' implementation to offer a *reliable*
> transport instance.
> For example, in [happybase|https://github.com/wbolster/happybase] (a
> developer-friendly Python library to interact with Apache HBase), it use
> isOpen() to judge whether it neccessary to reopen the connection in its
> [connection|https://github.com/wbolster/happybase/blob/9cbd718c10a3089f234f1eac1236b631e1f8e7cd/happybase/connection.py#L164]
> and connection pool.
> h2. Fix
> I would send a pull request to the github repo later.
> The implementation is according to Python's
> *[urllib3|https://github.com/shazow/urllib3/blob/0f98217c8125848dd3eded84d11b83c5caefaa97/urllib3/util/connection.py#L13]*
> module -- The most widely used Python HTTP library.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)