stiga-huang commented on code in PR #2732:
URL: https://github.com/apache/thrift/pull/2732#discussion_r1035492267


##########
lib/cpp/src/thrift/transport/TSocket.cpp:
##########
@@ -569,7 +569,7 @@ uint32_t TSocket::read(uint8_t* buf, uint32_t len) {
         throw TTransportException(TTransportException::INTERRUPTED, 
"Interrupted");
       }
     } else /* ret == 0 */ {
-      GlobalOutput.perror("TSocket::read() THRIFT_EAGAIN (timed out) after %f 
ms", recvTimeout_);
+      GlobalOutput.printf("TSocket::read() THRIFT_EAGAIN (timed out) after %d 
ms", recvTimeout_);

Review Comment:
   Sorry that I just mentioned it in the JIRA 
(https://issues.apache.org/jira/browse/THRIFT-5670). We saw a strange log when 
using cpp lib of thrift-0.16.0:
   ```
   I1114 15:50:53.952184 16548 thrift-util.cc:196] TSocket::read() 
THRIFT_EAGAIN (timed out) after %f ms: Unknown error 30000
   ```
   `recvTimeout_` (30000) is incorrectly used as `errno_copy` in 
`GlobalOutput.perror()`. `%f` is also not substituted as expected.
   
https://github.com/apache/thrift/blob/0.16.0/lib/cpp/src/thrift/TOutput.h#L40-L45
   `printf` is what exactly we need. BTW, `recvTimeout_` is a `int` so replace 
`%f` to `%d`.



-- 
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