[DocDB] Fix potential segv issue while fetching status of a sealed transaction #25439
Closed
Description
Jira Link: DB-14676
Description
Test SealTxnTest.Simple
fails with the following stack
PC: @ 0x0 (unknown)
*** SIGSEGV (@0x0) received by PID 158051 (TID 0x7fc2bb29d700) from PID 0; stack trace: ***
@ 0x7fc303d4e697 google::(anonymous namespace)::FailureSignalHandler()
@ 0x7fc301f7dd10 (unknown)
@ 0x7fc3044d923c yb::SubtxnSetPB::MergeFrom()
@ 0x7fc3044d9490 yb::SubtxnSetPB::CopyFrom()
@ 0x7fc308004ffe yb::tablet::TransactionCoordinator::Impl::GetStatus()
@ 0x7fc307ff0dac yb::tablet::TransactionCoordinator::GetStatus()
@ 0x7fc30857a2cd yb::tserver::TabletServiceImpl::GetTransactionStatus()
@ 0x7fc3063bd97f _ZN2yb3rpc10HandleCallINS0_19RpcCallPBParamsImplINS_7tserver29GetTransactionStatusRequestPBENS3_30GetTransactionStatusResponsePBEEEZZNS3_21TabletServerServiceIf11InitMethodsERK13scoped_refptrINS_12MetricEntityEEENKUlSt10shared_ptrINS0_11InboundCallEEE9_clESF_EUlPKS4_PS5_NS0_10RpcContextEE_EEDaSF_T0_
@ 0x7fc3063bdbb0 _ZNSt17_Function_handlerIFvSt10shared_ptrIN2yb3rpc11InboundCallEEEZNS1_7tserver21TabletServerServiceIf11InitMethodsERK13scoped_refptrINS1_12MetricEntityEEEUlS4_E9_E9_M_invokeERKSt9_Any_dataOS4_
@ 0x7fc3063b06be yb::tserver::TabletServerServiceIf::Handle()
@ 0x7fc30495f131 yb::rpc::ServicePoolImpl::Handle()
@ 0x7fc3048f0559 yb::rpc::InboundCall::InboundCallTask::Run()
@ 0x7fc30497250a yb::rpc::(anonymous namespace)::Worker::Execute()
@ 0x7fc30496f61d std::_Function_handler<>::_M_invoke()
While fetching the transaction status at the coordinator, if the transaction exists in the list of managed transactions, we access the iterator at a couple of places assuming we still hold the mutex. But looks like the lock can be released and re-acquired when dealing with sealed transactions, so accessing the earlier iterator after this release and re-acquisition of the lock isn't safe.
Issue Type
kind/bug
Warning: Please confirm that this issue does not contain any sensitive information
- I confirm this issue does not contain any sensitive information.