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

Trivial fix for CORE-4500: Firebird crashes after unsuccessful remapping of the lock table's shared memory.

This commit is contained in:
dimitr 2014-07-29 05:35:49 +00:00
parent e2d1b20425
commit 31bdbe0462

View File

@ -1655,26 +1655,29 @@ void LockManager::bug(ISC_STATUS* status_vector, const TEXT* string)
{
m_bugcheck = true;
// The lock table has some problem - copy it for later analysis
TEXT buffer[MAXPATHLEN];
gds__prefix_lock(buffer, "fb_lock_table.dump");
const TEXT* const lock_file = buffer;
FILE* const fd = fopen(lock_file, "wb");
if (fd)
if (m_header)
{
fwrite(m_header, 1, m_header->lhb_used, fd);
fclose(fd);
}
// The lock table has some problem - copy it for later analysis
// If the current mutex acquirer is in the same process, release the mutex
TEXT buffer[MAXPATHLEN];
gds__prefix_lock(buffer, "fb_lock_table.dump");
const TEXT* const lock_file = buffer;
FILE* const fd = fopen(lock_file, "wb");
if (fd)
{
fwrite(m_header, 1, m_header->lhb_used, fd);
fclose(fd);
}
if (m_header && (m_header->lhb_active_owner > 0))
{
const own* const owner = (own*) SRQ_ABS_PTR(m_header->lhb_active_owner);
const prc* const process = (prc*) SRQ_ABS_PTR(owner->own_process);
if (process->prc_process_id == PID)
release_shmem(m_header->lhb_active_owner);
// If the current mutex acquirer is in the same process, release the mutex
if (m_header->lhb_active_owner > 0)
{
const own* const owner = (own*) SRQ_ABS_PTR(m_header->lhb_active_owner);
const prc* const process = (prc*) SRQ_ABS_PTR(owner->own_process);
if (process->prc_process_id == PID)
release_shmem(m_header->lhb_active_owner);
}
}
if (status_vector)