Github user cherrot commented on the pull request:
https://github.com/apache/thrift/pull/945#issuecomment-196004421
Hi, after comparing the thrift lib for Java and C++, I agree to obey the
literal meaning of `isOpen` method by Socket API convention. That is to say, a
connection is __open__ unless it was closed explicitly.
Now the problem is, since `Thrift` hides the underlying `TSocket`, unless
using some tricks, I can't acces to the `socket` object from downstream
application (say [happybase](https://github.com/wbolster/happybase) in this
case) to determine whether it should be closed. Then it becomes so easy for a
normal user to create more and more connections until reaching the system limit.
So I hope `TTransport` could add an method calls something like
`shouldClose` or `isDropped`, inside which, using something like
`select([sock], [], [], 0.0)` to determine whether this socket should be
closed. __Or__ simply expose the `TSocket` object to the outer world.
FYI, according to
http://code.activestate.com/recipes/408997-when-to-not-just-use-socketclose/#c5
:
>Now, that incoming socket, which `select` just said was readable, has no
data waiting. According to asyncore, twisted, and every other asynchronous
package I've seen, when a socket is readable(), but has no data waiting, then
the remote machine has disconnected.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---