[fix](pipelineX) fix use-after-free in filter timer queue (#28236)

This commit is contained in:
Mryange
2023-12-12 17:25:14 +08:00
committed by GitHub
parent 4e50b2791a
commit f401a9c7ec
2 changed files with 6 additions and 7 deletions

View File

@ -116,7 +116,7 @@ std::string AndDependency::debug_string(int indentation_level) {
bool RuntimeFilterTimer::has_ready() {
std::unique_lock<std::mutex> lc(_lock);
return _runtime_filter->is_ready();
return _is_ready;
}
void RuntimeFilterTimer::call_timeout() {
@ -139,6 +139,7 @@ void RuntimeFilterTimer::call_ready() {
if (_parent) {
_parent->sub_filters();
}
_is_ready = true;
}
void RuntimeFilterTimer::call_has_ready() {
@ -160,7 +161,7 @@ void RuntimeFilterDependency::add_filters(IRuntimeFilter* runtime_filter) {
int32 wait_time_ms = runtime_filter->wait_time_ms();
auto filter_timer = std::make_shared<RuntimeFilterTimer>(
registration_time, wait_time_ms,
std::dynamic_pointer_cast<RuntimeFilterDependency>(shared_from_this()), runtime_filter);
std::dynamic_pointer_cast<RuntimeFilterDependency>(shared_from_this()));
runtime_filter->set_filter_timer(filter_timer);
ExecEnv::GetInstance()->runtime_filter_timer_queue()->push_filter_timer(filter_timer);
}

View File

@ -161,12 +161,10 @@ class RuntimeFilterDependency;
class RuntimeFilterTimer {
public:
RuntimeFilterTimer(int64_t registration_time, int32_t wait_time_ms,
std::shared_ptr<RuntimeFilterDependency> parent,
IRuntimeFilter* runtime_filter)
std::shared_ptr<RuntimeFilterDependency> parent)
: _parent(std::move(parent)),
_registration_time(registration_time),
_wait_time_ms(wait_time_ms),
_runtime_filter(runtime_filter) {}
_wait_time_ms(wait_time_ms) {}
void call_ready();
@ -188,7 +186,7 @@ private:
std::mutex _lock;
const int64_t _registration_time;
const int32_t _wait_time_ms;
IRuntimeFilter* _runtime_filter = nullptr;
bool _is_ready = false;
};
struct RuntimeFilterTimerQueue {