mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 04:43:03 +01:00
Backported fix for #7199: Various errors (strange messages in firebird.log, segfaults) with high rate of attach/detach database operations
This commit is contained in:
parent
b4d218e5a7
commit
f86f4edb52
@ -493,6 +493,15 @@ namespace Jrd
|
|||||||
|
|
||||||
// Database::GlobalObjectHolder class implementation
|
// Database::GlobalObjectHolder class implementation
|
||||||
|
|
||||||
|
int Database::GlobalObjectHolder::release() const
|
||||||
|
{
|
||||||
|
// Release should be executed under g_mutex protection
|
||||||
|
// in order to modify reference counter & hash table atomically
|
||||||
|
MutexLockGuard guard(g_mutex, FB_FUNCTION);
|
||||||
|
|
||||||
|
return RefCounted::release();
|
||||||
|
}
|
||||||
|
|
||||||
Database::GlobalObjectHolder* Database::GlobalObjectHolder::init(const string& id,
|
Database::GlobalObjectHolder* Database::GlobalObjectHolder::init(const string& id,
|
||||||
const PathName& filename,
|
const PathName& filename,
|
||||||
RefPtr<const Config> config)
|
RefPtr<const Config> config)
|
||||||
@ -512,17 +521,18 @@ namespace Jrd
|
|||||||
|
|
||||||
Database::GlobalObjectHolder::~GlobalObjectHolder()
|
Database::GlobalObjectHolder::~GlobalObjectHolder()
|
||||||
{
|
{
|
||||||
// here we cleanup what should not be globally protected
|
// dtor is executed under g_mutex protection
|
||||||
if (m_replMgr)
|
|
||||||
m_replMgr->shutdown();
|
|
||||||
|
|
||||||
MutexLockGuard guard(g_mutex, FB_FUNCTION);
|
|
||||||
|
|
||||||
Database::GlobalObjectHolder::DbId* entry = g_hashTable->lookup(m_id);
|
Database::GlobalObjectHolder::DbId* entry = g_hashTable->lookup(m_id);
|
||||||
if (!g_hashTable->remove(m_id))
|
if (!g_hashTable->remove(m_id))
|
||||||
fb_assert(false);
|
fb_assert(false);
|
||||||
|
|
||||||
// these objects should be deleted under g_mutex protection
|
{ // scope
|
||||||
|
// here we cleanup what should not be globally protected
|
||||||
|
MutexUnlockGuard guard(g_mutex, FB_FUNCTION);
|
||||||
|
if (m_replMgr)
|
||||||
|
m_replMgr->shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
m_lockMgr = nullptr;
|
m_lockMgr = nullptr;
|
||||||
m_eventMgr = nullptr;
|
m_eventMgr = nullptr;
|
||||||
m_replMgr = nullptr;
|
m_replMgr = nullptr;
|
||||||
|
@ -305,6 +305,8 @@ class Database : public pool_alloc<type_dbb>
|
|||||||
const Firebird::PathName& filename,
|
const Firebird::PathName& filename,
|
||||||
Firebird::RefPtr<const Firebird::Config> config);
|
Firebird::RefPtr<const Firebird::Config> config);
|
||||||
|
|
||||||
|
int release() const override;
|
||||||
|
|
||||||
~GlobalObjectHolder();
|
~GlobalObjectHolder();
|
||||||
|
|
||||||
LockManager* getLockManager();
|
LockManager* getLockManager();
|
||||||
|
Loading…
Reference in New Issue
Block a user