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

Fixed bug CORE-5350 : Assert in CachedMasterInterface::set

This commit is contained in:
hvlad 2016-11-17 13:12:40 +02:00
parent 6a32ca767e
commit be8a09d510
3 changed files with 38 additions and 24 deletions

View File

@ -585,36 +585,43 @@ public:
{ }
~MappingIpc()
{
shutdown();
}
void shutdown()
{
if (!sharedMemory)
return;
Guard gShared(this);
MappingHeader* sMem = sharedMemory->getHeader();
startupSemaphore.tryEnter(5);
sMem->process[process].flags &= ~MappingHeader::FLAG_ACTIVE;
(void) // Ignore errors in cleanup
sharedMemory->eventPost(&sMem->process[process].notifyEvent);
cleanupSemaphore.tryEnter(5);
// Ignore errors in cleanup
sharedMemory->eventFini(&sMem->process[process].notifyEvent);
sharedMemory->eventFini(&sMem->process[process].callbackEvent);
bool found = false;
for (unsigned n = 0; n < sMem->processes; ++n)
{
if (sMem->process[n].flags & MappingHeader::FLAG_ACTIVE)
{
found = true;
break;
}
}
Guard gShared(this);
MappingHeader* sMem = sharedMemory->getHeader();
if (!found)
sharedMemory->removeMapFile();
startupSemaphore.tryEnter(5);
sMem->process[process].flags &= ~MappingHeader::FLAG_ACTIVE;
(void) // Ignore errors in cleanup
sharedMemory->eventPost(&sMem->process[process].notifyEvent);
cleanupSemaphore.tryEnter(5);
// Ignore errors in cleanup
sharedMemory->eventFini(&sMem->process[process].notifyEvent);
sharedMemory->eventFini(&sMem->process[process].callbackEvent);
bool found = false;
for (unsigned n = 0; n < sMem->processes; ++n)
{
if (sMem->process[n].flags & MappingHeader::FLAG_ACTIVE)
{
found = true;
break;
}
}
if (!found)
sharedMemory->removeMapFile();
}
sharedMemory = NULL;
}
void clearMap(const char* dbName)
@ -1338,4 +1345,9 @@ RecordBuffer* MappingList::getList(thread_db* tdbb, jrd_rel* relation)
return getData(relation);
}
void shutdownMappingIpc()
{
mappingIpc->shutdown();
}
} // namespace Jrd

View File

@ -42,6 +42,7 @@ bool mapUser(Firebird::string& name, Firebird::string& trusted_role, Firebird::s
const char* alias, const char* db, const char* securityDb, Firebird::ICryptKeyCallback* cryptCb,
Firebird::IAttachment* att);
void clearMap(const char* dbName);
void shutdownMappingIpc();
class GlobalMappingScan: public VirtualTableScan
{

View File

@ -4134,6 +4134,7 @@ void JProvider::shutdown(CheckStatusWrapper* status, unsigned int timeout, const
// Do not put it into separate shutdown thread - during shutdown of TraceManager
// PluginManager wants to lock a mutex, which is sometimes already locked in current thread
TraceManager::shutdown();
shutdownMappingIpc();
}
catch (const Exception& ex)
{