sryanyuan commented on code in PR #2662:
URL: https://github.com/apache/kvrocks/pull/2662#discussion_r1841959706


##########
src/cluster/replication.cc:
##########
@@ -874,6 +876,12 @@ Status ReplicationThread::fetchFile(int sock_fd, evbuffer 
*evbuf, const std::str
     UniqueEvbufReadln line(evbuf, EVBUFFER_EOL_CRLF_STRICT);
     if (!line) {
       if (auto s = util::EvbufferRead(evbuf, sock_fd, -1, ssl); !s) {
+        if (errno == EAGAIN || errno == EWOULDBLOCK) {
+          if (stop_flag_) {
+            return {Status::NotOK, "replication thread was stopped"};
+          }
+          continue;
+        }

Review Comment:
   Our QA team tested and it do resolve the issue (On X86-64 centos).
   
   It depends on the return value of evbuffer_read, if it returns 0, it means 
the connection is EOF, or -1 if error occurred. So timeout will always return 
Status with NotOK and errno will be EAGAIN or EWOULDBLOCK as manual says:
   
   if no data has been transferred and the timeout has been reached then -1 is 
returned with errno set to EAGAIN or EWOULDBLOCK, or EINPROGRESS (for 
[connect](https://linux.die.net/man/2/connect)(2)) just as if the socket was 
specified to be nonblocking.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to