Yida Wu created IMPALA-15825:
--------------------------------

             Summary: Coordinator crashes with SIGSEGV under concurrency due to 
a race in runtime filter tracking
                 Key: IMPALA-15825
                 URL: https://issues.apache.org/jira/browse/IMPALA-15825
             Project: IMPALA
          Issue Type: Bug
          Components: Backend
            Reporter: Yida Wu


IMPALA-14796 added the map [Coordinator::effective_filter_targets_ 
|https://github.com/apache/impala/blob/d787e3c7853d662cc79d77c8a60a6fe741025459/be/src/runtime/coordinator.h#L528],
 which records the scans where each runtime filter was effective. 
Coordinator::UpdateBackendExecStatus() inserts into it without a lock in 
[https://github.com/apache/impala/blob/d787e3c7853d662cc79d77c8a60a6fe741025459/be/src/runtime/coordinator.cc#L1176|https://github.com/apache/impala/blob/d787e3c7853d662cc79d77c8a60a6fe741025459/be/src/runtime/coordinator.cc#L1176)):].
Each backend's status report runs on its own ReportExecStatus RPC thread. When 
several backends finish a query at about the same time, two threads can change 
the map at once and corrupt it. The coordinator then crashes with SIGSEGV:
std::_Rb_tree_insert_and_rebalance
impala::Coordinator::UpdateBackendExecStatus coordinator.cc:1176
impala::ClientRequestState::UpdateBackendExecStatus
impala::ControlService::ReportExecStatus
The code that reads the map isn't locked either: 
[FilterDebugString|https://github.com/apache/impala/blob/d787e3c7853d662cc79d77c8a60a6fe741025459/be/src/runtime/coordinator.cc#L710]()
 and 
[GetEffectiveFilterTargets|https://github.com/apache/impala/blob/d787e3c7853d662cc79d77c8a60a6fe741025459/be/src/runtime/coordinator.cc#L822](),
 which returns a reference to the map.

On a test cluster running 8 concurrent TPC-DS tests, the coordinator crashed 
about once an hour.

Repro (TSAN build, minicluster):
1. Build with CMAKE_BUILD_TYPE=TSAN and start the minicluster.
2. Run the query below from 6 impala-shell sessions at once, about 30 times 
each. A different o_orderdate each time is fine.
{code:java}
set mt_dop=4;
set runtime_filter_wait_time_ms=10000;
select count(*) from tpch_parquet.lineitem join tpch_parquet.orders
on l_orderkey = o_orderkey where o_orderdate = '1995-01-01';{code}
3. TSAN reports a data race on the map: a read in 
Coordinator::UpdateBackendExecStatus against an earlier write from another 
ReportExecStatus thread.

 



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to