Jens Geyer created THRIFT-6273:
----------------------------------

             Summary: C++: TNonblockingIOThread::breakLoop(true) aborts the 
whole process
                 Key: THRIFT-6273
                 URL: https://issues.apache.org/jira/browse/THRIFT-6273
             Project: Thrift
          Issue Type: Bug
          Components: C++ - Library
            Reporter: Jens Geyer


{{lib/cpp/src/thrift/server/TNonblockingServer.cpp:1501}}:

{code:cpp}
void TNonblockingIOThread::breakLoop(bool error) {
  if (error) {
    TOutput::instance().printf("TNonblockingServer: IO thread #%d exiting with 
error.", number_);
    // TODO: figure out something better to do here, but for now kill the
    // whole process.
    TOutput::instance().printf("TNonblockingServer: aborting process.");
    ::abort();
  }
  ...
{code}

One I/O thread that cannot continue takes down the process, including any other 
server or application code sharing it, with no chance for the caller to shut 
down in an orderly way. The {{TODO}} in the code says as much and has been 
there since the function was written.

Both call sites that pass {{true}} are in 
{{TNonblockingIOThread::notifyHandler()}} in the same file -- a short read on 
the notify socket ({{:1481}}) and a {{read()}} failure on it that is not 
{{EWOULDBLOCK}}/{{EAGAIN}} ({{:1492}}). So this is an internal-pipe failure, 
not something a peer drives; it is the design question the comment already 
raises.

h2. Suggested

Decide what the failure should do instead: stop that I/O thread and let the 
server report the failure through {{TServerEventHandler}}, or propagate it so 
{{TNonblockingServer::serve()}} can return. Either way the {{TODO}} can then go.

_Drafted with AI assistance (Claude Opus 5); reviewed and filed by Jens Geyer._



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to