Andrew Wong has submitted this change and it was merged. ( 
http://gerrit.cloudera.org:8080/17993 )

Change subject: [txns] fix UB in TxnSystemClient when adding max timeout to now
......................................................................

[txns] fix UB in TxnSystemClient when adding max timeout to now

This patch addresses the following UB found in a pre-commit:

/home/jenkins-slave/workspace/kudu-master/1/src/kudu/util/monotime.cc:220:10: 
runtime error: signed integer overflow: 271833850110 + 9223372036854775807 
cannot be represented in type 'long'
    #0 0x7f225fca9b31 in kudu::MonoTime::AddDelta(kudu::MonoDelta const&) 
/home/jenkins-slave/workspace/kudu-master/1/src/kudu/util/monotime.cc:220:10
    #1 0x7f225fcaaafe in kudu::operator+(kudu::MonoTime const&, kudu::MonoDelta 
const&) 
/home/jenkins-slave/workspace/kudu-master/1/src/kudu/util/monotime.cc:335:7
    #2 0x7f226fa3d6ff in 
kudu::transactions::TxnSystemClient::CoordinateTransactionAsync(kudu::tserver::CoordinatorOpPB,
 kudu::MonoDelta, std::function<void (kudu::Status const&)> const&, 
kudu::tserver::CoordinatorOpResultPB*) 
/home/jenkins-slave/workspace/kudu-master/1/src/kudu/transactions/txn_system_client.cc:331:45
    #3 0x7f226fa3feca in 
kudu::transactions::TxnSystemClient::KeepTransactionAlive(long, 
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > 
const&, kudu::MonoDelta) 
/home/jenkins-slave/workspace/kudu-master/1/src/kudu/transactions/txn_system_client.cc:320:3
    #4 0x7f2271211629 in 
kudu::transactions::TxnManager::KeepTransactionAlive(long, 
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > 
const&, kudu::MonoTime const&) 
/home/jenkins-slave/workspace/kudu-master/1/src/kudu/master/txn_manager.cc:238:27
    #5 0x7f227121535f in 
kudu::transactions::TxnManagerServiceImpl::KeepTransactionAlive(kudu::transactions::KeepTransactionAliveRequestPB
 const*, kudu::transactions::KeepTransactionAliveResponsePB*, 
kudu::rpc::RpcContext*) 
/home/jenkins-slave/workspace/kudu-master/1/src/kudu/master/txn_manager_service.cc:159:42
    #6 0x7f2265d5749e in std::function<void (google::protobuf::Message const*, 
google::protobuf::Message*, 
kudu::rpc::RpcContext*)>::operator()(google::protobuf::Message const*, 
google::protobuf::Message*, kudu::rpc::RpcContext*) const 
../../../include/c++/7.5.0/bits/std_function.h:706:14
    #7 0x7f2265d5648c in 
kudu::rpc::GeneratedServiceIf::Handle(kudu::rpc::InboundCall*) 
/home/jenkins-slave/workspace/kudu-master/1/src/kudu/rpc/service_if.cc:137:3
    #8 0x7f2265d5c42d in kudu::rpc::ServicePool::RunThread() 
/home/jenkins-slave/workspace/kudu-master/1/src/kudu/rpc/service_pool.cc:232:15
    #9 0x7f225fd596ba in kudu::Thread::SuperviseThread(void*) 
/home/jenkins-slave/workspace/kudu-master/1/src/kudu/util/thread.cc:674:3
    #10 0x7f22625026da in start_thread 
(/lib/x86_64-linux-gnu/libpthread.so.0+0x76da)
    #11 0x7f225bfea71e in clone (/lib/x86_64-linux-gnu/libc.so.6+0x12171e)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior 
/home/jenkins-slave/workspace/kudu-master/1/src/kudu/util/monotime.cc:220:10 in

Previously, we converted an initial deadline to a timeout, potentially
rejiggering the value in case of the maximal timeout, and then
recomputed the deadline. This patch addresses the UB by addressing a
TODO to pass deadlines in the context of the TxnSystemClient instead of
timeouts.

Change-Id: I1e5d4d06e8c0801c7f6b2399f7622e6f039f988e
Reviewed-on: http://gerrit.cloudera.org:8080/17993
Tested-by: Kudu Jenkins
Reviewed-by: Alexey Serbin <[email protected]>
Reviewed-by: Abhishek Chennaka <[email protected]>
---
M src/kudu/integration-tests/txn_commit-itest.cc
M src/kudu/integration-tests/txn_participant-itest.cc
M src/kudu/integration-tests/txn_status_table-itest.cc
M src/kudu/master/master.cc
M src/kudu/master/master.h
M src/kudu/master/txn_manager-test.cc
M src/kudu/master/txn_manager.cc
M src/kudu/tools/tool_action_txn.cc
M src/kudu/transactions/txn_status_manager.cc
M src/kudu/transactions/txn_system_client.cc
M src/kudu/transactions/txn_system_client.h
M src/kudu/tserver/ts_tablet_manager.cc
12 files changed, 121 insertions(+), 120 deletions(-)

Approvals:
  Kudu Jenkins: Verified
  Alexey Serbin: Looks good to me, approved
  Abhishek Chennaka: Looks good to me, but someone else must approve

--
To view, visit http://gerrit.cloudera.org:8080/17993
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I1e5d4d06e8c0801c7f6b2399f7622e6f039f988e
Gerrit-Change-Number: 17993
Gerrit-PatchSet: 4
Gerrit-Owner: Andrew Wong <[email protected]>
Gerrit-Reviewer: Abhishek Chennaka <[email protected]>
Gerrit-Reviewer: Alexey Serbin <[email protected]>
Gerrit-Reviewer: Andrew Wong <[email protected]>
Gerrit-Reviewer: Kudu Jenkins (120)

Reply via email to