X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/1844f9900f131a538d1cee988d76ef689c8426fe..ebdfad69dce1b3a1a48960328e5f6c3ed8fafa41:/src/redis.c?ds=sidebyside diff --git a/src/redis.c b/src/redis.c index 09146115..6e897d83 100644 --- a/src/redis.c +++ b/src/redis.c @@ -787,8 +787,11 @@ void beforeSleep(struct aeEventLoop *eventLoop) { c->flags &= ~REDIS_UNBLOCKED; /* Process remaining data in the input buffer. */ - if (c->querybuf && sdslen(c->querybuf) > 0) + if (c->querybuf && sdslen(c->querybuf) > 0) { + server.current_client = c; processInputBuffer(c); + server.current_client = NULL; + } } /* Write the AOF buffer on disk */ @@ -1002,6 +1005,7 @@ void initServer() { server.syslog_facility); } + server.current_client = NULL; server.clients = listCreate(); server.slaves = listCreate(); server.monitors = listCreate(); @@ -1425,6 +1429,7 @@ sds genRedisInfoString(char *section) { "redis_git_dirty:%d\r\n" "arch_bits:%s\r\n" "multiplexing_api:%s\r\n" + "gcc_version:%d.%d.%d\r\n" "process_id:%ld\r\n" "tcp_port:%d\r\n" "uptime_in_seconds:%ld\r\n" @@ -1435,6 +1440,11 @@ sds genRedisInfoString(char *section) { strtol(redisGitDirty(),NULL,10) > 0, (sizeof(long) == 8) ? "64" : "32", aeGetApiName(), +#ifdef __GNUC__ + __GNUC__,__GNUC_MINOR__,__GNUC_PATCHLEVEL__, +#else + 0,0,0, +#endif (long) getpid(), server.port, uptime, @@ -1999,6 +2009,40 @@ static void sigsegvHandler(int sig, siginfo_t *info, void *secret) { redisLogRaw(REDIS_WARNING, clients); /* Don't sdsfree() strings to avoid a crash. Memory may be corrupted. */ + /* Log CURRENT CLIENT info */ + if (server.current_client) { + redisClient *cc = server.current_client; + sds client; + int j; + + redisLog(REDIS_WARNING, "--- CURRENT CLIENT INFO"); + client = getClientInfoString(cc); + redisLog(REDIS_WARNING,"client: %s", client); + /* Missing sdsfree(client) to avoid crash if memory is corrupted. */ + for (j = 0; j < cc->argc; j++) { + robj *decoded; + + decoded = getDecodedObject(cc->argv[j]); + redisLog(REDIS_WARNING,"argv[%d]: '%s'", j, (char*)decoded->ptr); + decrRefCount(decoded); + } + /* Check if the first argument, usually a key, is found inside the + * selected DB, and if so print info about the associated object. */ + if (cc->argc >= 1) { + robj *val, *key; + dictEntry *de; + + key = getDecodedObject(cc->argv[1]); + de = dictFind(cc->db->dict, key->ptr); + if (de) { + val = dictGetVal(de); + redisLog(REDIS_WARNING,"key '%s' found in DB containing the following object:", key->ptr); + redisLogObjectDebugInfo(val); + } + decrRefCount(key); + } + } + redisLog(REDIS_WARNING, "=== REDIS BUG REPORT END. Make sure to include from START to END. ===\n\n" " Please report the crash opening an issue on github:\n\n"