Open sdm900 opened 7 years ago
This patch appears to fix it...
diff --git a/util/WdtSocket.cpp b/util/WdtSocket.cpp
index f8043d24d4..354ec1c765 100644
--- a/util/WdtSocket.cpp
+++ b/util/WdtSocket.cpp
@@ -149,6 +149,7 @@ int WdtSocket::writeInternal(const char *buf, int nbyte, int timeoutMs,
int w = writeWithAbortCheck(buf + written, nbyte - written, timeoutMs,
/* always try to write everything */ true);
if (w <= 0) {
+ if (errno == EAGAIN || errno == EINTR) continue;
break;
}
written += w;
@@ -158,7 +159,7 @@ int WdtSocket::writeInternal(const char *buf, int nbyte, int timeoutMs,
}
}
if (written != nbyte) {
- WLOG(ERROR) << "Socket write failure " << written << " " << nbyte;
+ WLOG(ERROR) << "Socket write failure " << written << " " << nbyte << " error " << errno << " " << std::strerror(errno) ;
writeErrorCode_ = SOCKET_WRITE_ERROR;
return -1;
}
What I don't understand is why you have a loop in WdtSocket::writeInternal at all. It is calling writeWithAbortCheck which to the best of my understanding is doing the same loop and handling the same errors...
I mean I understand that I'm basically setting an infinite timeout on the socket (by ignoring the check in WdtSocket::ioWithAbortCheck - but I'm setting the timeout to read and write timeouts to 20s... so they shouldn't really ever be hit.
I have an issue where we get errors when sending large files over long fast links.
I instrumented the code (so I could see what the errno was) and got
which is telling me that the write should be "try again"... but WDT just crashes out.
Lines like
are not protected against EAGAIN...
Why? Is their something in the design that is meant to handle this?
Why aren't the error messages spitting out the errno and string version? eg.
Thanks.