From 37282330c0ea687fd1b983176dce85731fcf189d Mon Sep 17 00:00:00 2001 From: Robert Nishihara Date: Tue, 1 Aug 2017 23:33:25 -0700 Subject: [PATCH] Allow plasma manager to gracefully handle EPROTOTYPE. (#802) * Allow plasma manager to gracefully handle EPROTOTYPE. * Fix linting. --- src/plasma/plasma_manager.cc | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/src/plasma/plasma_manager.cc b/src/plasma/plasma_manager.cc index a0ba1dba4..5ed29d79e 100644 --- a/src/plasma/plasma_manager.cc +++ b/src/plasma/plasma_manager.cc @@ -47,15 +47,34 @@ int handle_sigpipe(Status s, int fd) { if (s.ok()) { return 0; } - if (errno == EPIPE || errno == EBADF || errno == ECONNRESET) { + + switch (errno) { + case EPIPE: { ARROW_LOG(WARNING) - << "Received SIGPIPE, BAD FILE DESCRIPTOR, or ECONNRESET when " - "sending a message to client on fd " - << fd << ". The client on the other end may " - "have hung up."; - return errno; + << "Received EPIPE when sending a message to client on fd " << fd + << ". The client on the other end may have hung up."; + } break; + case EBADF: { + ARROW_LOG(WARNING) + << "Received EBADF when sending a message to client on fd " << fd + << ". The client on the other end may have hung up."; + } break; + case ECONNRESET: { + ARROW_LOG(WARNING) + << "Received ECONNRESET when sending a message to client on fd " << fd + << ". The client on the other end may have hung up."; + } break; + case EPROTOTYPE: { + /* TODO(rkn): What triggers this case? */ + ARROW_LOG(WARNING) + << "Received EPROTOTYPE when sending a message to client on fd " << fd + << ". The client on the other end may have hung up."; + } break; + default: + /* This code should be unreachable. */ + CHECK(0); + LOG_FATAL("Failed to write message to client on fd %d", fd); } - ARROW_LOG(FATAL) << "Failed to write message to client on fd " << fd << "."; } /**