From 0d5c71d90aee938ae6918c69ff50f1a81c648337 Mon Sep 17 00:00:00 2001 From: AlexPeshkoff Date: Fri, 3 Jun 2022 18:38:59 +0300 Subject: [PATCH] Posfix for #7199: Various errors (strange messages in firebird.log, segfaults) with high rate of attach/detach database operations: partially restored old logic to avoid problems with replication shutdown --- src/jrd/Database.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/jrd/Database.cpp b/src/jrd/Database.cpp index afbfd19ce6..720715b489 100644 --- a/src/jrd/Database.cpp +++ b/src/jrd/Database.cpp @@ -527,13 +527,17 @@ namespace Jrd Database::GlobalObjectHolder::~GlobalObjectHolder() { // dtor is executed under glblObjectsMutex protection - if (m_replMgr) - m_replMgr->shutdown(); - Database::GlobalObjectHolder::DbId* entry = g_hashTable->lookup(m_id); if (!g_hashTable->remove(m_id)) fb_assert(false); + { // scope + // here we cleanup what should not be globally protected + MutexUnlockGuard guard(glblObjectsMutex, FB_FUNCTION); + if (m_replMgr) + m_replMgr->shutdown(); + } + m_lockMgr = nullptr; m_eventMgr = nullptr; m_replMgr = nullptr;