avoid rpc_timeout overflow
This commit is contained in:
7
deps/oblib/src/rpc/obrpc/ob_poc_rpc_proxy.h
vendored
7
deps/oblib/src/rpc/obrpc/ob_poc_rpc_proxy.h
vendored
@ -141,6 +141,11 @@ public:
|
||||
}
|
||||
{
|
||||
lib::Thread::RpcGuard guard(addr, pcode);
|
||||
int64_t relative_timeout = get_proxy_timeout(proxy);
|
||||
if (relative_timeout > INT64_MAX/2) {
|
||||
RPC_LOG_RET(WARN, OB_INVALID_ARGUMENT, "rpc timeout is too large", K(relative_timeout), K(pcode));
|
||||
relative_timeout = INT64_MAX/2;
|
||||
}
|
||||
if (OB_FAIL(rpc_encode_req(proxy, pool, pcode, args, opts, req, req_sz, false))) {
|
||||
RPC_LOG(WARN, "rpc encode req fail", K(ret));
|
||||
} else if(OB_FAIL(check_blacklist(addr))) {
|
||||
@ -149,7 +154,7 @@ public:
|
||||
const pn_pkt_t pkt = {
|
||||
req,
|
||||
req_sz,
|
||||
start_ts + get_proxy_timeout(proxy),
|
||||
start_ts + relative_timeout,
|
||||
static_cast<int16_t>(set.idx_of_pcode(pcode)),
|
||||
ObSyncRespCallback::client_cb,
|
||||
&cb
|
||||
|
||||
14
deps/oblib/src/rpc/obrpc/ob_rpc_proxy.ipp
vendored
14
deps/oblib/src/rpc/obrpc/ob_rpc_proxy.ipp
vendored
@ -73,10 +73,15 @@ int SSHandle<pcodeStruct>::get_more(typename pcodeStruct::Response &result)
|
||||
} else if(OB_FAIL(ObPocClientStub::check_blacklist(dst_))) {
|
||||
RPC_LOG(WARN, "check_blacklist failed", K(ret));
|
||||
} else {
|
||||
int64_t relative_timeout = proxy_.timeout();
|
||||
if (relative_timeout > INT64_MAX/2) {
|
||||
RPC_LOG_RET(WARN, OB_INVALID_ARGUMENT, "rpc timeout is too large", K(relative_timeout), K(pcode_));
|
||||
relative_timeout = INT64_MAX/2;
|
||||
}
|
||||
const pn_pkt_t pkt = {
|
||||
pnio_req,
|
||||
pnio_req_sz,
|
||||
start_ts + proxy_.timeout(),
|
||||
start_ts + relative_timeout,
|
||||
static_cast<int16_t>(set.idx_of_pcode(pcode_)),
|
||||
ObSyncRespCallback::client_cb,
|
||||
&cb
|
||||
@ -218,10 +223,15 @@ int SSHandle<pcodeStruct>::abort()
|
||||
} else if(OB_FAIL(ObPocClientStub::check_blacklist(dst_))) {
|
||||
RPC_LOG(WARN, "check_blacklist failed", K(ret));
|
||||
} else {
|
||||
int64_t relative_timeout = proxy_.timeout();
|
||||
if (relative_timeout > INT64_MAX/2) {
|
||||
RPC_LOG_RET(WARN, OB_INVALID_ARGUMENT, "rpc timeout is too large", K(relative_timeout), K(pcode_));
|
||||
relative_timeout = INT64_MAX/2;
|
||||
}
|
||||
const pn_pkt_t pkt = {
|
||||
pnio_req,
|
||||
pnio_req_sz,
|
||||
start_ts + proxy_.timeout(),
|
||||
start_ts + relative_timeout,
|
||||
static_cast<int16_t>(set.idx_of_pcode(pcode_)),
|
||||
ObSyncRespCallback::client_cb,
|
||||
&cb
|
||||
|
||||
Reference in New Issue
Block a user