diff --git a/src/debug.cpp b/src/debug.cpp index 3a4520776..234f197be 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -55,7 +55,7 @@ typedef ucontext_t sigcontext_t; #endif #endif -bool g_fInCrash = false; +int g_fInCrash = false; /* ================================= Debugging ============================== */ diff --git a/src/fastlock.cpp b/src/fastlock.cpp index 1bbc2d6d5..7a946fa8f 100644 --- a/src/fastlock.cpp +++ b/src/fastlock.cpp @@ -59,6 +59,7 @@ #define UNUSED(x) ((void)x) #endif +extern int g_fInCrash; /**************************************************** * @@ -150,7 +151,7 @@ class DeadlockDetector public: void registerwait(fastlock *lock, pid_t thispid) { - if (lock == &m_lock) + if (lock == &m_lock || g_fInCrash) return; fastlock_lock(&m_lock); m_mapwait.insert(std::make_pair(thispid, lock)); @@ -191,7 +192,7 @@ public: void clearwait(fastlock *lock, pid_t thispid) { - if (lock == &m_lock) + if (lock == &m_lock || g_fInCrash) return; fastlock_lock(&m_lock); m_mapwait.erase(thispid); diff --git a/src/networking.cpp b/src/networking.cpp index 6aa7e109f..45a66e387 100644 --- a/src/networking.cpp +++ b/src/networking.cpp @@ -1509,7 +1509,6 @@ int writeToClient(int fd, client *c, int handler_installed) { } else { serverLog(LL_VERBOSE, "Error writing to client: %s", strerror(errno)); - lock.unlock(); freeClientAsync(c); return C_ERR; @@ -1528,7 +1527,6 @@ int writeToClient(int fd, client *c, int handler_installed) { /* Close connection after entire reply has been sent. */ if (c->flags & CLIENT_CLOSE_AFTER_REPLY) { - lock.unlock(); freeClientAsync(c); return C_ERR; } @@ -3000,7 +2998,6 @@ int processEventsWhileBlocked(int iel) { int iterations = 4; /* See the function top-comment. */ int count = 0; - aeReleaseLock(); while (iterations--) { int events = 0; events += aeProcessEvents(g_pserver->rgthreadvar[iel].el, AE_FILE_EVENTS|AE_DONT_WAIT); @@ -3008,7 +3005,6 @@ int processEventsWhileBlocked(int iel) { if (!events) break; count += events; } - aeAcquireLock(); return count; } diff --git a/src/redis-benchmark.cpp b/src/redis-benchmark.cpp index 17866bec1..4f59c0a15 100644 --- a/src/redis-benchmark.cpp +++ b/src/redis-benchmark.cpp @@ -173,6 +173,8 @@ typedef struct redisConfig { sds appendonly; } redisConfig; +int g_fInCrash = false; + /* Prototypes */ static void writeHandler(aeEventLoop *el, int fd, void *privdata, int mask); static void createMissingClients(client c); diff --git a/src/redis-cli.c b/src/redis-cli.c index eae4a1d0e..f2c255c35 100644 --- a/src/redis-cli.c +++ b/src/redis-cli.c @@ -90,6 +90,8 @@ int spectrum_palette_mono[] = {0,233,234,235,237,239,241,243,245,247,249,251,253 int *spectrum_palette; int spectrum_palette_size; +int g_fInCrash = false; + /*------------------------------------------------------------------------------ * Utility functions *--------------------------------------------------------------------------- */ diff --git a/src/server.h b/src/server.h index 19958e180..7c90a88c8 100644 --- a/src/server.h +++ b/src/server.h @@ -2797,7 +2797,7 @@ void xorDigest(unsigned char *digest, const void *ptr, size_t len); int populateCommandTableParseFlags(struct redisCommand *c, const char *strflags); int moduleGILAcquiredByModule(void); -extern bool g_fInCrash; +extern int g_fInCrash; static inline int GlobalLocksAcquired(void) // Used in asserts to verify all global locks are correctly acquired for a server-thread to operate { return aeThreadOwnsLock() || moduleGILAcquiredByModule() || g_fInCrash;