From f612c6673d48d8bbb343eedba92da093217d4f80 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Wed, 2 Mar 2022 17:40:33 +0000 Subject: Admin: shutdown cleanly to avoid races during close. Suspect cause for SEGV in: std::_Rb_tree, std::allocator >, std::pair, std::allocator > const, std::shared_ptr >, std::_Select1st, std::allocator > const, std::shared_ptr > >, std::less, std::allocator > >, std::allocator, std::allocator > const, std::shared_ptr > > >::find(std::__cxx11::basic_string, std::allocator > const&) COOLWSD::closeDocument(std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&) Admin::triggerMemoryCleanup(unsigned long) Admin::pollingThread() Change-Id: Id09e4db4b21cb7a11dddb867758aded4b28ff3ec Signed-off-by: Michael Meeks --- wsd/Admin.cpp | 5 +++++ wsd/Admin.hpp | 1 + wsd/LOOLWSD.cpp | 3 +++ 3 files changed, 9 insertions(+) diff --git a/wsd/Admin.cpp b/wsd/Admin.cpp index 1a78bf25dc..ba75f81d7f 100644 --- a/wsd/Admin.cpp +++ b/wsd/Admin.cpp @@ -958,4 +958,9 @@ void Admin::start() startThread(); } +void Admin::stop() +{ + joinThread(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/wsd/Admin.hpp b/wsd/Admin.hpp index 01f531337b..dc8059fbf0 100644 --- a/wsd/Admin.hpp +++ b/wsd/Admin.hpp @@ -67,6 +67,7 @@ public: } void start(); + void stop(); /// Custom poll thread function void pollingThread() override; diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp index 6a4ceeaff4..0fdf94334d 100644 --- a/wsd/LOOLWSD.cpp +++ b/wsd/LOOLWSD.cpp @@ -3922,6 +3922,9 @@ public: { _acceptPoll.joinThread(); WebServerPoll.joinThread(); +#if !MOBILEAPP + Admin::instance().stop(); +#endif } void dumpState(std::ostream& os) -- cgit