8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 21:23:04 +01:00

Additional fix for bug CORE-6253 : Crash caused by the locked fb_lock file

Retry attempts to initialize shared memory when truncation of shmem file was failed with ERROR_USER_MAPPED_FILE.
The case is when last process that holds shared memory and its initialization event was killed (or crashed) and
didn't released OS objects in correct order (event, file, memory mappings).
I.e. new process successfully creates event, correctly consider itself as initializator, but failed to truncate
file as it is still in use by old instance of memory mappings in killed\crashed process.
This prevents bugcheck in LM and abort() as consequence.
This commit is contained in:
hvlad 2020-07-07 16:06:18 +03:00
parent 8348349b05
commit d5fad960e7

View File

@ -2253,7 +2253,12 @@ SharedMemoryBase::SharedMemoryBase(const TEXT* filename, ULONG length, IpcObject
CloseHandle(file_handle);
if (err == ERROR_USER_MAPPED_FILE)
{
if (retry_count < 50) // 0.5 sec
goto retry;
Arg::Gds(isc_instance_conflict).raise();
}
else
system_call_failed::raise("SetFilePointer", err);
}