mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 15:23:02 +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_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_no_ast = 0x800L; // AST delivery is prohibited
|
||||||
const ULONG DBB_sweep_in_progress = 0x1000L; // A database sweep operation is in progress
|
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_suspend_bgio = 0x4000L; // Suspend I/O by background threads
|
||||||
const ULONG DBB_new = 0x8000L; // Database object is just created
|
const ULONG DBB_new = 0x8000L; // Database object is just created
|
||||||
const ULONG DBB_gc_cooperative = 0x10000L; // cooperative garbage collection
|
const ULONG DBB_gc_cooperative = 0x10000L; // cooperative garbage collection
|
||||||
|
@ -2301,6 +2301,13 @@ void VIO_init(thread_db* tdbb)
|
|||||||
// If there's no presence of a garbage collector running then start one up.
|
// If there's no presence of a garbage collector running then start one up.
|
||||||
|
|
||||||
if (!(dbb->dbb_flags & DBB_garbage_collector))
|
if (!(dbb->dbb_flags & DBB_garbage_collector))
|
||||||
|
{
|
||||||
|
const ULONG old = dbb->dbb_flags.exchangeBitOr(DBB_gc_starting);
|
||||||
|
if (!(old & DBB_gc_starting))
|
||||||
|
{
|
||||||
|
if (old & DBB_garbage_collector)
|
||||||
|
dbb->dbb_flags &= ~DBB_gc_starting;
|
||||||
|
else
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -2308,11 +2315,14 @@ void VIO_init(thread_db* tdbb)
|
|||||||
}
|
}
|
||||||
catch (const Exception&)
|
catch (const Exception&)
|
||||||
{
|
{
|
||||||
|
dbb->dbb_flags &= ~DBB_gc_starting;
|
||||||
ERR_bugcheck_msg("cannot start garbage collector thread");
|
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
|
// Database backups and sweeps perform their own garbage collection
|
||||||
// unless passing a no garbage collect switch which means don't
|
// unless passing a no garbage collect switch which means don't
|
||||||
@ -4531,6 +4541,7 @@ static THREAD_ENTRY_DECLARE garbage_collector(THREAD_ENTRY_PARAM arg)
|
|||||||
|
|
||||||
// Notify our creator that we have started
|
// Notify our creator that we have started
|
||||||
dbb->dbb_flags |= DBB_garbage_collector;
|
dbb->dbb_flags |= DBB_garbage_collector;
|
||||||
|
dbb->dbb_flags &= ~DBB_gc_starting;
|
||||||
dbb->dbb_gc_init.release();
|
dbb->dbb_gc_init.release();
|
||||||
|
|
||||||
// The garbage collector flag is cleared to request the thread
|
// The garbage collector flag is cleared to request the thread
|
||||||
|
Loading…
Reference in New Issue
Block a user