Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions lib/cpp/src/thrift/transport/TServerSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,7 @@ bool TServerSocket::isUnixDomainSocket() const {
}

shared_ptr<TTransport> TServerSocket::acceptImpl() {
try_again:
if (serverSocket_ == THRIFT_INVALID_SOCKET) {
throw TTransportException(TTransportException::NOT_OPEN, "TServerSocket not listening");
}
Expand Down Expand Up @@ -654,8 +655,15 @@ shared_ptr<TTransport> TServerSocket::acceptImpl() {

if (clientSocket == THRIFT_INVALID_SOCKET) {
int errno_copy = THRIFT_GET_SOCKET_ERROR;
GlobalOutput.perror("TServerSocket::acceptImpl() ::accept() ", errno_copy);
throw TTransportException(TTransportException::UNKNOWN, "accept()", errno_copy);
// In case of an ECONNABORTED error or any other error with the accept
// call retry the accept again instead of raising the exception which
// might kill the thrift server and hence making the thrift server
// unresponsive. The error can happen when accept syscall call, waiting
// for an incoming connection, or receiving a connection that terminates
// before the accept process completes, hence killing the thrift serve
GlobalOutput.perror("TServerSocket::acceptImpl() ::accept() Retrying ",
errno_copy);
goto try_again;
}

// Make sure client socket is blocking
Expand Down