Fix crash on shutdown with snapshots pending
Former-commit-id: 124e79a81d6995ea7d5ba39d1830b591b705acbf
This commit is contained in:
parent
7d3ed909eb
commit
69b550d91a
@ -2463,8 +2463,8 @@ void redisDbPersistentData::commitChanges()
|
|||||||
|
|
||||||
redisDbPersistentData::~redisDbPersistentData()
|
redisDbPersistentData::~redisDbPersistentData()
|
||||||
{
|
{
|
||||||
if (m_pdbSnapshotASYNC)
|
if (m_spdbSnapshotHOLDER != nullptr)
|
||||||
endSnapshot(m_pdbSnapshotASYNC);
|
endSnapshot(m_spdbSnapshotHOLDER.get());
|
||||||
|
|
||||||
//serverAssert(m_pdbSnapshot == nullptr);
|
//serverAssert(m_pdbSnapshot == nullptr);
|
||||||
serverAssert(m_refCount == 0);
|
serverAssert(m_refCount == 0);
|
||||||
|
@ -721,6 +721,6 @@ cant_free:
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int freeMemoryIfNeededAndSafe(bool fPreSnapshot) {
|
int freeMemoryIfNeededAndSafe(bool fPreSnapshot) {
|
||||||
if (g_pserver->lua_timedout || g_pserver->loading) return C_OK;
|
if (g_pserver->shutdown_asap || g_pserver->lua_timedout || g_pserver->loading) return C_OK;
|
||||||
return freeMemoryIfNeeded(fPreSnapshot);
|
return freeMemoryIfNeeded(fPreSnapshot);
|
||||||
}
|
}
|
||||||
|
@ -5926,10 +5926,16 @@ int main(int argc, char **argv) {
|
|||||||
pthread_join(rgthread[iel], &pvRet);
|
pthread_join(rgthread[iel], &pvRet);
|
||||||
|
|
||||||
/* free our databases */
|
/* free our databases */
|
||||||
|
bool fLockAcquired = aeTryAcquireLock(false);
|
||||||
|
g_pserver->shutdown_asap = true; // flag that we're in shutdown
|
||||||
|
if (!fLockAcquired)
|
||||||
|
g_fInCrash = true; // We don't actually crash right away, because we want to sync any storage providers
|
||||||
for (int idb = 0; idb < cserver.dbnum; ++idb) {
|
for (int idb = 0; idb < cserver.dbnum; ++idb) {
|
||||||
delete g_pserver->db[idb];
|
delete g_pserver->db[idb];
|
||||||
g_pserver->db[idb] = nullptr;
|
g_pserver->db[idb] = nullptr;
|
||||||
}
|
}
|
||||||
|
// If we couldn't acquire the global lock it means something wasn't shutdown and we'll probably deadlock
|
||||||
|
serverAssert(fLockAcquired);
|
||||||
|
|
||||||
g_pserver->garbageCollector.shutdown();
|
g_pserver->garbageCollector.shutdown();
|
||||||
delete g_pserver->m_pstorageFactory;
|
delete g_pserver->m_pstorageFactory;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user