[ https://issues.apache.org/jira/browse/THRIFT-2441?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14491618#comment-14491618 ]
ASF GitHub Bot commented on THRIFT-2441: ---------------------------------------- Github user jeking3 commented on a diff in the pull request: https://github.com/apache/thrift/pull/424#discussion_r28205714 --- Diff: lib/cpp/src/thrift/transport/TSocket.cpp --- @@ -493,29 +585,9 @@ uint32_t TSocket::read(uint8_t* buf, uint32_t len) { goto try_again; } -#if defined __FreeBSD__ || defined __MACH__ if (errno_copy == THRIFT_ECONNRESET) { - /* shigin: freebsd doesn't follow POSIX semantic of recv and fails with - * THRIFT_ECONNRESET if peer performed shutdown - * edhall: eliminated close() since we do that in the destructor. - */ return 0; } -#endif - -#ifdef _WIN32 --- End diff -- Hi Roger, thanks for inspecting this closely. I determined that if one called read() on a closed socket, it was not returning 0 like it should. It turns out that the block seen above which was limiting the logic for handling ECONNRESET to __FreeBSD__ and __MACH__ should be ubiquitous. If a read() errors with ECONNRESET the proper response is to return 0 indicating EOF. The WIN32 block is the same, given THRIFT_ECONNRESET == WSAECONNRESET when _WIN32 is enabled. As such, now all platforms respond to connection reset during read with 0, meaning EOF. Does the CI build test framework test Windows and run the CMake tests? If so, then the TServerIntegrationTest will test your concern. I did not run this code on Windows to make sure it builds or passes tests, but I can do that on Monday if needed. > 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 > Attachments: THRIFT-2441-prelim.patch > > > 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)