Skip to content

CMakeLists.txt#5

Open
iHuydang wants to merge 1 commit intoexness:developfrom
iHuydang:patch-5
Open

CMakeLists.txt#5
iHuydang wants to merge 1 commit intoexness:developfrom
iHuydang:patch-5

Conversation

@iHuydang
Copy link

No description provided.

michael-lutsenko pushed a commit that referenced this pull request Jun 12, 2025
…lanceScheduler

`~SubscribeSentinel()` calls `storage_->Stop();` that calls `rebalance_scheduler_.reset()`; after that `~SubscribeSentinel()` resets the `Sentinel::impl_`.

After `rebalance_scheduler_.reset()` but before `Sentinel::impl_.reset()` a `topology_holder_` may gen a notification that calls `sentinel_obj_.Notify*` that calls `rebalance_scheduler_->Rebalance*`:

```
#0 0x7f4fbe737fc4 in __pthread_mutex_lock
#1 0xd928c8 in __libcpp_mutex_lock
#2 0xd928c8 in std::__y1::mutex::lock()
#3 0x224289b in lock_guard
#4 0x224289b in storages::redis::impl::SubscriptionRebalanceScheduler::RequestRebalance(std::__y1::unordered_map<storages::redis::ServerId, unsigned long, storages::redis::ServerIdHasher, std::__y1::equal_to<storages::redis::ServerId>, std::__y1::allocator<std::__y1::pair<storages::redis::ServerId const, unsigned long>>>) /userver/redis/src/storages/redis/impl/subscription_rebalance_scheduler.cpp:37:43
#5 0x22369e9 in storages::redis::impl::ClusterSubscriptionStorage::RequestRebalance(unsigned long, std::__y1::unordered_map<storages::redis::ServerId, unsigned long, storages::redis::ServerIdHasher, std::__y1::equal_to<storages::redis::ServerId>, std::__y1::allocator<std::__y1::pair<storages::redis::ServerId const, unsigned long>>>) /userver/redis/src/storages/redis/impl/cluster_subscription_storage.cpp:139:27
#6 0x223019f in storages::redis::impl::SubscribeSentinel::RebalanceSubscriptions(unsigned long) /userver/redis/src/storages/redis/impl/subscribe_sentinel.cpp:171:15
#7 0x2193ccd in operator() /userver/redis/src/storages/redis/impl/cluster_sentinel_impl.cpp:885:27
#8 0x2193ccd in boost::detail::function::void_function_obj_invoker<storages::redis::impl::ClusterSentinelImpl::Init()::$_0, void, std::__y1::basic_string<char, std::__y1::char_traits<char>, std::__y1::allocator<char>>, storages::redis::RedisState>::invoke(boost::detail::function::function_buffer&, std::__y1::basic_string<char, std::__y1::char_traits<char>, std::__y1::allocator<char>>, storages::redis::RedisState)
```

We must call Stop() instead of reset.

`ClusterSentinelImpl::Stop()` does a blocking `ev_thread_.Run*`, so all the signal callbacks finish execution before destruction.

Tests: протестировано локально и в CI
commit_hash:c731ae2859d6acde9605e2c526cd9ac20f15e4e8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant