Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
0.9.1, 0.9.2
-
None
-
None
Description
In ./lib/cpp/src/thrift/transport/TSocket.cpp, function void TSocket::openConnection(struct addrinfo *res)
If *nix connect() is interrupted, it should not be aborted and throw a TException, this will result subsequent connect() failures.
When we close the socket connection on signal EINTR and retry, we will end up in same old state and stuck in loop.
Instead, if connect() is interrupted by a signal that is caught, while blocked waiting to establish a connection, connect() shall fail and set connect() to [EINTR], but the connection request shall not be aborted, and the connection shall be established asynchronously.
In the current thrift code, when connect() fails due to interruptions, an exception is thrown and user have no way to establish the connection later.
273 ret = connect(socket_, res->ai_addr, static_cast<int>(res->ai_addrlen));
274 }
275
276 // success case
277 if (ret == 0)
280
281 if ((THRIFT_GET_SOCKET_ERROR != THRIFT_EINPROGRESS) && (THRIFT_GET_SOCKET_ERROR != THRIFT_EWOULDBLOCK))