mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 10:43:03 +01:00
Fixed bug CORE-4575 : AV in garbage collector thread at disconnect of last attachment
This commit is contained in:
parent
fd924ee3c7
commit
18806682fd
@ -208,7 +208,7 @@ const ULONG DBB_read_only = 0x200L; // DB is ReadOnly (RO). If not set, DB i
|
||||
const ULONG DBB_being_opened_read_only = 0x400L; // DB is being opened RO. If unset, opened as RW
|
||||
const ULONG DBB_no_ast = 0x800L; // AST delivery is prohibited
|
||||
const ULONG DBB_sweep_in_progress = 0x1000L; // A database sweep operation is in progress
|
||||
const ULONG DBB_security_db = 0x2000L; // ISC security database
|
||||
const ULONG DBB_gc_starting = 0x2000L; // garbage collector thread is starting
|
||||
const ULONG DBB_suspend_bgio = 0x4000L; // Suspend I/O by background threads
|
||||
const ULONG DBB_new = 0x8000L; // Database object is just created
|
||||
const ULONG DBB_gc_cooperative = 0x10000L; // cooperative garbage collection
|
||||
|
@ -2302,16 +2302,26 @@ void VIO_init(thread_db* tdbb)
|
||||
|
||||
if (!(dbb->dbb_flags & DBB_garbage_collector))
|
||||
{
|
||||
try
|
||||
const ULONG old = dbb->dbb_flags.exchangeBitOr(DBB_gc_starting);
|
||||
if (!(old & DBB_gc_starting))
|
||||
{
|
||||
Thread::start(garbage_collector, dbb, THREAD_medium);
|
||||
}
|
||||
catch (const Exception&)
|
||||
{
|
||||
ERR_bugcheck_msg("cannot start garbage collector thread");
|
||||
}
|
||||
if (old & DBB_garbage_collector)
|
||||
dbb->dbb_flags &= ~DBB_gc_starting;
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
Thread::start(garbage_collector, dbb, THREAD_medium);
|
||||
}
|
||||
catch (const Exception&)
|
||||
{
|
||||
dbb->dbb_flags &= ~DBB_gc_starting;
|
||||
ERR_bugcheck_msg("cannot start garbage collector thread");
|
||||
}
|
||||
|
||||
dbb->dbb_gc_init.enter();
|
||||
dbb->dbb_gc_init.enter();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Database backups and sweeps perform their own garbage collection
|
||||
@ -4531,6 +4541,7 @@ static THREAD_ENTRY_DECLARE garbage_collector(THREAD_ENTRY_PARAM arg)
|
||||
|
||||
// Notify our creator that we have started
|
||||
dbb->dbb_flags |= DBB_garbage_collector;
|
||||
dbb->dbb_flags &= ~DBB_gc_starting;
|
||||
dbb->dbb_gc_init.release();
|
||||
|
||||
// The garbage collector flag is cleared to request the thread
|
||||
|
Loading…
Reference in New Issue
Block a user