[ https://issues.apache.org/jira/browse/THRIFT-2441?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14391440#comment-14391440 ]
Ben Craig commented on THRIFT-2441: ----------------------------------- "Did not provide a way to maintain the current behavior of blocking stop() until all clients disconnect. I view this as a defect, however it is the current behavior. Is it a requirement to be able to continue to provide this behavior?" As stated, no, it is not a requirement that stop() block until all clients disconnect. What is a requirement though is to continue providing a version of read() that only makes one system call to recv(), and not two calls (one to select() and one to recv()). "Would this count as 3 open file descriptors per client instead of one?" Yes it would. I've had that cause problems before. "Is that acceptable, or should the TServer provide each TTransport with a common way to be interrupted that is transport-agnostic?" I know of no such method. On Windows, sockets are very different from named pipes, and I don't know of a way to wait on both at the same time without spawning off extra threads or entirely abandoning the bsd socket implementation. I do like the idea of a ServerTransport's interrupt causing child Transports to get interrupted. I think that would make it easier for there to be a bool somewhere on the server transport to turn off the behavior in order to regain performance. So here's my counter proposal... 1. Add a constructor to TSocket... TSocket(THRIFT_SOCKET real_socket, THRIFT_SOCKET death_listener) 2. Add a getter / setter to TServerSocket to allow people to disable the behavior. My preference is that the new, robust, but slow behavior be the default. 3. Inside TServerSocket::createSocket, check the above flag. If you want the old behavior, call the one-socket constructor. If you want the new behavior, call the two-socket constructor with intSock2_ as the death_listener. 4. Inside of TSocker, base which read behavior you want on whether death_listener was set or not. Other transports may need to do more elaborate book keeping instead of just passing around an extra socket descriptor, but this leaves the exact mechanism up to those implementations. > Cannot shutdown TThreadedServer when clients are still connected > ---------------------------------------------------------------- > > Key: THRIFT-2441 > URL: https://issues.apache.org/jira/browse/THRIFT-2441 > Project: Thrift > Issue Type: Bug > Components: C++ - Library > Affects Versions: 0.9.1 > Reporter: Chris Stylianou > Assignee: Ben Craig > > When calling stop() on the TThreadedServer no interrupts are sent to the > client threads. This means the stop() call blocks on tasksMonitor.wait() > until all client naturally disconnect. > How can we tell the client thread connections to close/exit during the > TThreadedServer::stop() call? -- This message was sent by Atlassian JIRA (v6.3.4#6332)