[
https://issues.apache.org/jira/browse/THRIFT-3080?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14395717#comment-14395717
]
ASF GitHub Bot commented on THRIFT-3080:
----------------------------------------
Github user jeking3 commented on a diff in the pull request:
https://github.com/apache/thrift/pull/422#discussion_r27768849
--- Diff: lib/cpp/src/thrift/server/TNonblockingServer.cpp ---
@@ -1393,9 +1394,39 @@ bool
TNonblockingIOThread::notify(TNonblockingServer::TConnection* conn) {
return false;
}
- const int kSize = sizeof(conn);
- if (send(fd, const_cast_sockopt(&conn), kSize, 0) != kSize) {
- return false;
+ int ret = -1;
+ struct pollfd pfd = {fd, POLLOUT, 0};
+ int kSize = sizeof(conn);
+ const char * pos = (const char *)const_cast_sockopt(&conn);
+
+ while (kSize > 0) {
+ pfd.revents = 0;
+ ret = poll(&pfd, 1, -1);
--- End diff --
TServerSocket has a macro based implementation that is portable for
reference.
> C++ TNonblockingServer connection leak while accept huge number connections.
> ----------------------------------------------------------------------------
>
> Key: THRIFT-3080
> URL: https://issues.apache.org/jira/browse/THRIFT-3080
> Project: Thrift
> Issue Type: Bug
> Affects Versions: 0.9.2
> Reporter: Lei FW
> Priority: Critical
>
> while huge number connections are accepted, the send() syscall on the unix
> socket for the IO Thread may fail and return EAGAIN, but no one care about
> the failed sent fd, neither retry nor clean.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)