You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Ata E Husain Bohra (JIRA)" <ji...@apache.org> on 2015/02/18 21:36:12 UTC
[jira] [Commented] (THRIFT-1642) Miscalculation lead to throw
unexpected "TTransportException::TIMED_OUT"(or called "EAGAIN (timed out)")
exception
[ https://issues.apache.org/jira/browse/THRIFT-1642?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14326512#comment-14326512 ]
Ata E Husain Bohra commented on THRIFT-1642:
--------------------------------------------
Kuldeep,
The reasoning for setting timeout and retires hold true. BUT, still their is a issue in a way computation for "readElapsedMicros" is done:
"
uint32_t readElapsedMicros = (((end.tv_sec - begin.tv_sec) * 1000 * 1000)
+ (((uint64_t)(end.tv_usec - begin.tv_usec))));
"
it should be:
"
uint32_t readElapsedMicros = (((end.tv_sec - begin.tv_sec) * 1000 * 1000)
+ (((int64_t)(end.tv_usec - begin.tv_usec))));
'
Would it make sense to port this change upstream given it leads to mis-calculation very easily.
Thanks
> Miscalculation lead to throw unexpected "TTransportException::TIMED_OUT"(or called "EAGAIN (timed out)") exception
> ------------------------------------------------------------------------------------------------------------------
>
> Key: THRIFT-1642
> URL: https://issues.apache.org/jira/browse/THRIFT-1642
> Project: Thrift
> Issue Type: Bug
> Components: C++ - Library
> Affects Versions: 0.8
> Environment: GNU/Linux x86_64
> Reporter: catxl
> Priority: Critical
> Attachments: TSocket.cpp.patch
>
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> In function 'uint32_t TSocket::read(uint8_t* buf, uint32_t len)', there's an miscalculation which can lead to wrong judgment:
> struct timeval begin;
> gettimeofday(&begin, NULL);
> //
> // do some thing
> //
> struct timeval end;
> gettimeofday(&end, NULL);
> uint32_t readElapsedMicros = (((end.tv_sec - begin.tv_sec) * 1000 * 1000)
> + (((uint64_t)(end.tv_usec - begin.tv_usec))));
> 'readElapsedMicros' will be very large when 'end.tv_usec < begin.tv_usec'.
> This will lead to throw unexpected "TTransportException::TIMED_OUT"(or called "EAGAIN (timed out)") exception sometimes.
> Besides,
> (1)I don't think the "usleep(50);" call in the same function above is necessary, I think delete this call could improve performance.
> (2)I don't know why 'readElapsedMicros' compare with 'eagainThresholdMicros', which is not the value (recvTimeout_*1000), but:
> eagainThresholdMicros = (recvTimeout_*1000)/ ((maxRecvRetries_>0) ? maxRecvRetries_ : 2);
> can anyone tell me someting about this? Thank you!
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)