bneradt commented on code in PR #13329:
URL: https://github.com/apache/trafficserver/pull/13329#discussion_r3477457130


##########
src/shared/rpc/IPCSocketClient.cc:
##########
@@ -89,13 +89,24 @@ IPCSocketClient::connect(std::chrono::milliseconds wait_ms, 
int attempts)
 std::int64_t
 IPCSocketClient::_safe_write(int fd, const char *buffer, int len)
 {
+  constexpr int WRITE_READY_TIMEOUT_MS = 1000;
+
   std::int64_t written{0};
   while (written < len) {
     const ssize_t ret = ::write(fd, buffer + written, len - written);
     if (ret == -1) {
-      if (errno == EAGAIN || errno == EINTR) {
+      if (errno == EINTR) {
         continue;
       }
+      if (errno == EAGAIN || errno == EWOULDBLOCK) {
+        if (write_ready(fd, WRITE_READY_TIMEOUT_MS) == 1) {
+          continue;
+        }
+      }
+      return -1;

Review Comment:
   Fixed in fb13f27906. _safe_write now sets errno = ETIMEDOUT when 
write_ready() returns 0, while preserving the existing errno for write_ready() 
< 0. The regression test also checks that the timeout path returns -1 with 
ETIMEDOUT.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to