You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@thrift.apache.org by Lihua Yu <pe...@163.com> on 2010/06/24 07:29:42 UTC
TCompactProtocol(C++) doesn't work together with TBufferedTranport
How to Repeat:
any client: TCompactProtocol/TSocket
any server: SimpleServer/TCompactProtocol/TBufferedTranport
client call server, and server will block.
Possbile Cause:
TCompactProtocol::readVarint32() is based on TCompactProtocol::readVarint64().
the code of readVarint64() is as follows:
int shift = 0;
uint8_t buf[10]; // 64 bits / (7 bits/byte) = 10 bytes.
uint32_t buf_size = sizeof(buf);
const uint8_t* borrowed = trans_->borrow(buf, &buf_size);
if the underlying tranport is TBufferedTransport, and the avaiable data is less than 10 bytes, i.e. 7 bytes
TCompactProtocol::readVarint64 blocks.
2010-06-24
Lihua Yu