Open
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.