Skip to content

Commit 2d3f59f

Browse files
committed
[fix](be) Run the do_submit debug point callback only when one is set
### What problem does this PR solve? Issue Number: None Related PR: #68610 Problem Summary: The debug point ThreadPool.do_submit.wait_for_thread_start called DBUG_RUN_CALLBACK() unconditionally. DebugPoint::execute_callback() throws std::invalid_argument when no callback is set, so enabling the point by name without a callback (for example through the HTTP debug point action) made every submit to a pool that is waiting for its first worker throw out of ThreadPool::do_submit(). Check dp->callback.has_value() first, as the ThreadPool.create_thread.inject_failure point next to it already does. ### Release note None ### Check List (For Author) - Test: Unit Test - run-be-ut.sh with ThreadPoolTest.* and ScannerProjectionTest.* (31 tests passed) - Behavior changed: No - Does this need documentation: No
1 parent 03980e1 commit 2d3f59f

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎be/src/util/threadpool.cpp‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,9 @@ Status ThreadPool::do_submit(std::shared_ptr<Runnable> r, ThreadPoolToken* token
442442
if (_num_threads == 0 && _num_threads_pending_start > 0 && _pool_status.ok()) {
443443
// Tells a test that this submit is about to wait. The lock is held until the wait
444444
// below releases it, so the pending thread start cannot complete in between.
445-
DBUG_RUN_CALLBACK();
445+
if (dp->callback.has_value()) {
446+
DBUG_RUN_CALLBACK();
447+
}
446448
}
447449
})
448450
_thread_start_cond.wait(l, [this]() {

0 commit comments

Comments
 (0)