Skip to content

fix: Auth ReservationHandler, clear timer map before stopping io context#1832

Merged
hikinggrass merged 1 commit into
mainfrom
bugfix/reservation-handler-dtor-fix
Feb 18, 2026
Merged

fix: Auth ReservationHandler, clear timer map before stopping io context#1832
hikinggrass merged 1 commit into
mainfrom
bugfix/reservation-handler-dtor-fix

Conversation

@hikinggrass
Copy link
Copy Markdown
Member

Additionally reset the executor_work_guard in dtor before stopping the io_context

This fixes some invalid read errors reported by valgrind: ==4131335== Invalid read of size 8
==4131335== at 0x688DB6: std::__atomic_base::operator--() (atomic_base.h:406)
==4131335== by 0x67C87B: boost::asio::detail::scheduler::work_finished() (scheduler.hpp:108)
==4131335== by 0x68A45B: boost::asio::io_context::basic_executor_type<std::allocator, 0ul>::on_work_finished() const (io_context.hpp:264)
==4131335== by 0x691A23: boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::allocator, 0ul>, void, void>::~executor_work_guard() (executor_work_guard.hpp:122)
==4131335== by 0x70C228: boost::detail::sp_ms_deleter<boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::allocator, 0ul>, void, void> >::destroy() (make_shared_object.hpp:55)
==4131335== by 0x7144F7: boost::detail::sp_ms_deleter<boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::allocator, 0ul>, void, void> >::operator()(boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::allocator, 0ul>, void, void>) (make_shared_object.hpp:89)
==4131335== by 0x7141F0: boost::detail::sp_counted_impl_pd<boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::allocator, 0ul>, void, void>
, boost::detail::sp_ms_deleter<boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::allocator, 0ul>, void, void> > >::dispose() (sp_counted_impl.hpp:113)
==4131335== by 0x564F0C: boost::detail::sp_counted_base::release() (sp_counted_base_std_atomic.hpp:118)
==4131335== by 0x565012: boost::detail::shared_count::~shared_count() (shared_count.hpp:352)
==4131335== by 0x6E7B1B: boost::shared_ptr<boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::allocator, 0ul>, void, void> >::~shared_ptr() (shared_ptr.hpp:253)
==4131335== by 0x6D107F: module::ReservationHandler::~ReservationHandler() (ReservationHandler.cpp:34)
==4131335== by 0x715833: module::AuthHandler::~AuthHandler() (AuthHandler.cpp:59)

Describe your changes

Issue ticket number and link

Checklist before requesting a review

  • I have performed a self-review of my code
  • I have made corresponding changes to the documentation
  • I read the contribution documentation and made sure that my changes meet its requirements

Additionally reset the executor_work_guard in dtor before stopping the io_context

This fixes some invalid read errors reported by valgrind:
==4131335== Invalid read of size 8
==4131335==    at 0x688DB6: std::__atomic_base<long>::operator--() (atomic_base.h:406)
==4131335==    by 0x67C87B: boost::asio::detail::scheduler::work_finished() (scheduler.hpp:108)
==4131335==    by 0x68A45B: boost::asio::io_context::basic_executor_type<std::allocator<void>, 0ul>::on_work_finished() const (io_context.hpp:264)
==4131335==    by 0x691A23: boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::allocator<void>, 0ul>, void, void>::~executor_work_guard() (executor_work_guard.hpp:122)
==4131335==    by 0x70C228: boost::detail::sp_ms_deleter<boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::allocator<void>, 0ul>, void, void> >::destroy() (make_shared_object.hpp:55)
==4131335==    by 0x7144F7: boost::detail::sp_ms_deleter<boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::allocator<void>, 0ul>, void, void> >::operator()(boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::allocator<void>, 0ul>, void, void>*) (make_shared_object.hpp:89)
==4131335==    by 0x7141F0: boost::detail::sp_counted_impl_pd<boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::allocator<void>, 0ul>, void, void>*, boost::detail::sp_ms_deleter<boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::allocator<void>, 0ul>, void, void> > >::dispose() (sp_counted_impl.hpp:113)
==4131335==    by 0x564F0C: boost::detail::sp_counted_base::release() (sp_counted_base_std_atomic.hpp:118)
==4131335==    by 0x565012: boost::detail::shared_count::~shared_count() (shared_count.hpp:352)
==4131335==    by 0x6E7B1B: boost::shared_ptr<boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::allocator<void>, 0ul>, void, void> >::~shared_ptr() (shared_ptr.hpp:253)
==4131335==    by 0x6D107F: module::ReservationHandler::~ReservationHandler() (ReservationHandler.cpp:34)
==4131335==    by 0x715833: module::AuthHandler::~AuthHandler() (AuthHandler.cpp:59)

Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
@hikinggrass hikinggrass added include-in-release Tag that this PR should be included in the current merge window for the upcoming release if possible labels Feb 18, 2026
@hikinggrass hikinggrass added this pull request to the merge queue Feb 18, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Feb 18, 2026
@hikinggrass hikinggrass added this pull request to the merge queue Feb 18, 2026
Merged via the queue into main with commit 106a743 Feb 18, 2026
12 checks passed
@hikinggrass hikinggrass deleted the bugfix/reservation-handler-dtor-fix branch February 18, 2026 16:14
mlitre pushed a commit that referenced this pull request Feb 19, 2026
…ext (#1832)

Additionally reset the executor_work_guard in dtor before stopping the io_context

This fixes some invalid read errors reported by valgrind:
==4131335== Invalid read of size 8
==4131335==    at 0x688DB6: std::__atomic_base<long>::operator--() (atomic_base.h:406)
==4131335==    by 0x67C87B: boost::asio::detail::scheduler::work_finished() (scheduler.hpp:108)
==4131335==    by 0x68A45B: boost::asio::io_context::basic_executor_type<std::allocator<void>, 0ul>::on_work_finished() const (io_context.hpp:264)
==4131335==    by 0x691A23: boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::allocator<void>, 0ul>, void, void>::~executor_work_guard() (executor_work_guard.hpp:122)
==4131335==    by 0x70C228: boost::detail::sp_ms_deleter<boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::allocator<void>, 0ul>, void, void> >::destroy() (make_shared_object.hpp:55)
==4131335==    by 0x7144F7: boost::detail::sp_ms_deleter<boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::allocator<void>, 0ul>, void, void> >::operator()(boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::allocator<void>, 0ul>, void, void>*) (make_shared_object.hpp:89)
==4131335==    by 0x7141F0: boost::detail::sp_counted_impl_pd<boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::allocator<void>, 0ul>, void, void>*, boost::detail::sp_ms_deleter<boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::allocator<void>, 0ul>, void, void> > >::dispose() (sp_counted_impl.hpp:113)
==4131335==    by 0x564F0C: boost::detail::sp_counted_base::release() (sp_counted_base_std_atomic.hpp:118)
==4131335==    by 0x565012: boost::detail::shared_count::~shared_count() (shared_count.hpp:352)
==4131335==    by 0x6E7B1B: boost::shared_ptr<boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::allocator<void>, 0ul>, void, void> >::~shared_ptr() (shared_ptr.hpp:253)
==4131335==    by 0x6D107F: module::ReservationHandler::~ReservationHandler() (ReservationHandler.cpp:34)
==4131335==    by 0x715833: module::AuthHandler::~AuthHandler() (AuthHandler.cpp:59)

Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
mlitre pushed a commit that referenced this pull request Feb 19, 2026
…ext (#1832)

Additionally reset the executor_work_guard in dtor before stopping the io_context

This fixes some invalid read errors reported by valgrind:
==4131335== Invalid read of size 8
==4131335==    at 0x688DB6: std::__atomic_base<long>::operator--() (atomic_base.h:406)
==4131335==    by 0x67C87B: boost::asio::detail::scheduler::work_finished() (scheduler.hpp:108)
==4131335==    by 0x68A45B: boost::asio::io_context::basic_executor_type<std::allocator<void>, 0ul>::on_work_finished() const (io_context.hpp:264)
==4131335==    by 0x691A23: boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::allocator<void>, 0ul>, void, void>::~executor_work_guard() (executor_work_guard.hpp:122)
==4131335==    by 0x70C228: boost::detail::sp_ms_deleter<boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::allocator<void>, 0ul>, void, void> >::destroy() (make_shared_object.hpp:55)
==4131335==    by 0x7144F7: boost::detail::sp_ms_deleter<boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::allocator<void>, 0ul>, void, void> >::operator()(boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::allocator<void>, 0ul>, void, void>*) (make_shared_object.hpp:89)
==4131335==    by 0x7141F0: boost::detail::sp_counted_impl_pd<boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::allocator<void>, 0ul>, void, void>*, boost::detail::sp_ms_deleter<boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::allocator<void>, 0ul>, void, void> > >::dispose() (sp_counted_impl.hpp:113)
==4131335==    by 0x564F0C: boost::detail::sp_counted_base::release() (sp_counted_base_std_atomic.hpp:118)
==4131335==    by 0x565012: boost::detail::shared_count::~shared_count() (shared_count.hpp:352)
==4131335==    by 0x6E7B1B: boost::shared_ptr<boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::allocator<void>, 0ul>, void, void> >::~shared_ptr() (shared_ptr.hpp:253)
==4131335==    by 0x6D107F: module::ReservationHandler::~ReservationHandler() (ReservationHandler.cpp:34)
==4131335==    by 0x715833: module::AuthHandler::~AuthHandler() (AuthHandler.cpp:59)

Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Signed-off-by: Martin Litre <mnlitre@gmail.com>
Dalachowsky pushed a commit to Dalachowsky/everest-core that referenced this pull request Feb 20, 2026
…ext (EVerest#1832)

Additionally reset the executor_work_guard in dtor before stopping the io_context

This fixes some invalid read errors reported by valgrind:
==4131335== Invalid read of size 8
==4131335==    at 0x688DB6: std::__atomic_base<long>::operator--() (atomic_base.h:406)
==4131335==    by 0x67C87B: boost::asio::detail::scheduler::work_finished() (scheduler.hpp:108)
==4131335==    by 0x68A45B: boost::asio::io_context::basic_executor_type<std::allocator<void>, 0ul>::on_work_finished() const (io_context.hpp:264)
==4131335==    by 0x691A23: boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::allocator<void>, 0ul>, void, void>::~executor_work_guard() (executor_work_guard.hpp:122)
==4131335==    by 0x70C228: boost::detail::sp_ms_deleter<boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::allocator<void>, 0ul>, void, void> >::destroy() (make_shared_object.hpp:55)
==4131335==    by 0x7144F7: boost::detail::sp_ms_deleter<boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::allocator<void>, 0ul>, void, void> >::operator()(boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::allocator<void>, 0ul>, void, void>*) (make_shared_object.hpp:89)
==4131335==    by 0x7141F0: boost::detail::sp_counted_impl_pd<boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::allocator<void>, 0ul>, void, void>*, boost::detail::sp_ms_deleter<boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::allocator<void>, 0ul>, void, void> > >::dispose() (sp_counted_impl.hpp:113)
==4131335==    by 0x564F0C: boost::detail::sp_counted_base::release() (sp_counted_base_std_atomic.hpp:118)
==4131335==    by 0x565012: boost::detail::shared_count::~shared_count() (shared_count.hpp:352)
==4131335==    by 0x6E7B1B: boost::shared_ptr<boost::asio::executor_work_guard<boost::asio::io_context::basic_executor_type<std::allocator<void>, 0ul>, void, void> >::~shared_ptr() (shared_ptr.hpp:253)
==4131335==    by 0x6D107F: module::ReservationHandler::~ReservationHandler() (ReservationHandler.cpp:34)
==4131335==    by 0x715833: module::AuthHandler::~AuthHandler() (AuthHandler.cpp:59)

Signed-off-by: Kai-Uwe Hermann <kai-uwe.hermann@pionix.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working include-in-release Tag that this PR should be included in the current merge window for the upcoming release if possible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants