2012-11-08 12:25:23 -05:00
/*
2020-07-29 10:05:14 -04:00
* Copyright ( c ) 2009 - 2020 , Salvatore Sanfilippo < antirez at gmail dot com >
* Copyright ( c ) 2020 , Redis Labs , Inc
2012-11-08 12:25:23 -05:00
* All rights reserved .
*
* Redistribution and use in source and binary forms , with or without
* modification , are permitted provided that the following conditions are met :
*
* * Redistributions of source code must retain the above copyright notice ,
* this list of conditions and the following disclaimer .
* * Redistributions in binary form must reproduce the above copyright
* notice , this list of conditions and the following disclaimer in the
* documentation and / or other materials provided with the distribution .
* * Neither the name of Redis nor the names of its contributors may be used
* to endorse or promote products derived from this software without
* specific prior written permission .
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS " AS IS "
* AND ANY EXPRESS OR IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED . IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT , INDIRECT , INCIDENTAL , SPECIAL , EXEMPLARY , OR
* CONSEQUENTIAL DAMAGES ( INCLUDING , BUT NOT LIMITED TO , PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES ; LOSS OF USE , DATA , OR PROFITS ; OR BUSINESS
* INTERRUPTION ) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY , WHETHER IN
* CONTRACT , STRICT LIABILITY , OR TORT ( INCLUDING NEGLIGENCE OR OTHERWISE )
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE , EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE .
*/
2015-07-26 09:14:57 -04:00
# include "server.h"
2010-06-21 18:07:48 -04:00
# include "sha1.h" /* SHA1 is used for DEBUG DIGEST */
2012-11-29 08:20:08 -05:00
# include "crc64.h"
2020-07-29 10:05:14 -04:00
# include "bio.h"
2010-06-21 18:07:48 -04:00
2010-07-01 15:13:38 -04:00
# include <arpa/inet.h>
2012-01-20 06:20:45 -05:00
# include <signal.h>
2016-09-26 18:29:47 -04:00
# include <dlfcn.h>
2020-07-29 10:05:14 -04:00
# include <fcntl.h>
# include <unistd.h>
2012-01-20 06:20:45 -05:00
# ifdef HAVE_BACKTRACE
# include <execinfo.h>
2018-11-25 03:10:26 -05:00
# ifndef __OpenBSD__
2012-01-20 06:20:45 -05:00
# include <ucontext.h>
2018-11-25 03:10:26 -05:00
# else
typedef ucontext_t sigcontext_t ;
# endif
2012-01-20 06:20:45 -05:00
# endif /* HAVE_BACKTRACE */
2010-07-01 15:13:38 -04:00
2014-05-12 10:56:43 -04:00
# ifdef __CYGWIN__
# ifndef SA_ONSTACK
# define SA_ONSTACK 0x08000000
# endif
# endif
2021-03-01 01:15:26 -05:00
# if defined(__APPLE__) && defined(__arm64__)
# include <mach/mach.h>
# endif
2020-07-29 10:05:14 -04:00
/* Globals */
2020-08-24 06:54:33 -04:00
static int bug_report_start = 0 ; /* True if bug report header was already logged. */
static pthread_mutex_t bug_report_start_mutex = PTHREAD_MUTEX_INITIALIZER ;
2020-07-29 10:05:14 -04:00
/* Forward declarations */
void bugReportStart ( void ) ;
void printCrashReport ( void ) ;
void bugReportEnd ( int killViaSignal , int sig ) ;
void logStackTrace ( void * eip , int uplevel ) ;
2010-06-21 18:07:48 -04:00
/* ================================= Debugging ============================== */
/* Compute the sha1 of string at 's' with 'len' bytes long.
2013-01-16 12:00:20 -05:00
* The SHA1 is then xored against the string pointed by digest .
2010-06-21 18:07:48 -04:00
* Since xor is commutative , this operation is used in order to
* " add " digests relative to unordered elements .
*
* So digest ( a , b , c , d ) will be the same of digest ( b , a , c , d ) */
void xorDigest ( unsigned char * digest , void * ptr , size_t len ) {
SHA1_CTX ctx ;
unsigned char hash [ 20 ] , * s = ptr ;
int j ;
SHA1Init ( & ctx ) ;
SHA1Update ( & ctx , s , len ) ;
SHA1Final ( hash , & ctx ) ;
for ( j = 0 ; j < 20 ; j + + )
digest [ j ] ^ = hash [ j ] ;
}
2018-12-07 10:30:33 -05:00
void xorStringObjectDigest ( unsigned char * digest , robj * o ) {
2010-06-21 18:07:48 -04:00
o = getDecodedObject ( o ) ;
xorDigest ( digest , o - > ptr , sdslen ( o - > ptr ) ) ;
decrRefCount ( o ) ;
}
/* This function instead of just computing the SHA1 and xoring it
2013-01-16 12:00:20 -05:00
* against digest , also perform the digest of " digest " itself and
2010-06-21 18:07:48 -04:00
* replace the old value with the new one .
*
* So the final digest will be :
*
* digest = SHA1 ( digest xor SHA1 ( data ) )
*
* This function is used every time we want to preserve the order so
* that digest ( a , b , c , d ) will be different than digest ( b , c , d , a )
*
* Also note that mixdigest ( " foo " ) followed by mixdigest ( " bar " )
* will lead to a different digest compared to " fo " , " obar " .
*/
void mixDigest ( unsigned char * digest , void * ptr , size_t len ) {
SHA1_CTX ctx ;
char * s = ptr ;
xorDigest ( digest , s , len ) ;
SHA1Init ( & ctx ) ;
SHA1Update ( & ctx , digest , 20 ) ;
SHA1Final ( digest , & ctx ) ;
}
2018-12-07 10:30:33 -05:00
void mixStringObjectDigest ( unsigned char * digest , robj * o ) {
2010-06-21 18:07:48 -04:00
o = getDecodedObject ( o ) ;
mixDigest ( digest , o - > ptr , sdslen ( o - > ptr ) ) ;
decrRefCount ( o ) ;
}
2018-12-07 10:30:33 -05:00
/* This function computes the digest of a data structure stored in the
* object ' o ' . It is the core of the DEBUG DIGEST command : when taking the
* digest of a whole dataset , we take the digest of the key and the value
* pair , and xor all those together .
*
* Note that this function does not reset the initial ' digest ' passed , it
* will continue mixing this object digest to anything that was already
* present . */
void xorObjectDigest ( redisDb * db , robj * keyobj , unsigned char * digest , robj * o ) {
uint32_t aux = htonl ( o - > type ) ;
mixDigest ( digest , & aux , sizeof ( aux ) ) ;
long long expiretime = getExpire ( db , keyobj ) ;
char buf [ 128 ] ;
/* Save the key and associated value */
if ( o - > type = = OBJ_STRING ) {
mixStringObjectDigest ( digest , o ) ;
} else if ( o - > type = = OBJ_LIST ) {
listTypeIterator * li = listTypeInitIterator ( o , 0 , LIST_TAIL ) ;
listTypeEntry entry ;
while ( listTypeNext ( li , & entry ) ) {
robj * eleobj = listTypeGet ( & entry ) ;
mixStringObjectDigest ( digest , eleobj ) ;
decrRefCount ( eleobj ) ;
}
listTypeReleaseIterator ( li ) ;
} else if ( o - > type = = OBJ_SET ) {
setTypeIterator * si = setTypeInitIterator ( o ) ;
sds sdsele ;
while ( ( sdsele = setTypeNextObject ( si ) ) ! = NULL ) {
xorDigest ( digest , sdsele , sdslen ( sdsele ) ) ;
sdsfree ( sdsele ) ;
}
setTypeReleaseIterator ( si ) ;
} else if ( o - > type = = OBJ_ZSET ) {
unsigned char eledigest [ 20 ] ;
if ( o - > encoding = = OBJ_ENCODING_ZIPLIST ) {
unsigned char * zl = o - > ptr ;
unsigned char * eptr , * sptr ;
unsigned char * vstr ;
unsigned int vlen ;
long long vll ;
double score ;
eptr = ziplistIndex ( zl , 0 ) ;
serverAssert ( eptr ! = NULL ) ;
sptr = ziplistNext ( zl , eptr ) ;
serverAssert ( sptr ! = NULL ) ;
while ( eptr ! = NULL ) {
serverAssert ( ziplistGet ( eptr , & vstr , & vlen , & vll ) ) ;
score = zzlGetScore ( sptr ) ;
memset ( eledigest , 0 , 20 ) ;
if ( vstr ! = NULL ) {
mixDigest ( eledigest , vstr , vlen ) ;
} else {
ll2string ( buf , sizeof ( buf ) , vll ) ;
mixDigest ( eledigest , buf , strlen ( buf ) ) ;
}
snprintf ( buf , sizeof ( buf ) , " %.17g " , score ) ;
mixDigest ( eledigest , buf , strlen ( buf ) ) ;
xorDigest ( digest , eledigest , 20 ) ;
zzlNext ( zl , & eptr , & sptr ) ;
}
} else if ( o - > encoding = = OBJ_ENCODING_SKIPLIST ) {
zset * zs = o - > ptr ;
dictIterator * di = dictGetIterator ( zs - > dict ) ;
dictEntry * de ;
while ( ( de = dictNext ( di ) ) ! = NULL ) {
sds sdsele = dictGetKey ( de ) ;
double * score = dictGetVal ( de ) ;
snprintf ( buf , sizeof ( buf ) , " %.17g " , * score ) ;
memset ( eledigest , 0 , 20 ) ;
mixDigest ( eledigest , sdsele , sdslen ( sdsele ) ) ;
mixDigest ( eledigest , buf , strlen ( buf ) ) ;
xorDigest ( digest , eledigest , 20 ) ;
}
dictReleaseIterator ( di ) ;
} else {
serverPanic ( " Unknown sorted set encoding " ) ;
}
} else if ( o - > type = = OBJ_HASH ) {
hashTypeIterator * hi = hashTypeInitIterator ( o ) ;
while ( hashTypeNext ( hi ) ! = C_ERR ) {
unsigned char eledigest [ 20 ] ;
sds sdsele ;
memset ( eledigest , 0 , 20 ) ;
sdsele = hashTypeCurrentObjectNewSds ( hi , OBJ_HASH_KEY ) ;
mixDigest ( eledigest , sdsele , sdslen ( sdsele ) ) ;
sdsfree ( sdsele ) ;
sdsele = hashTypeCurrentObjectNewSds ( hi , OBJ_HASH_VALUE ) ;
mixDigest ( eledigest , sdsele , sdslen ( sdsele ) ) ;
sdsfree ( sdsele ) ;
xorDigest ( digest , eledigest , 20 ) ;
}
hashTypeReleaseIterator ( hi ) ;
} else if ( o - > type = = OBJ_STREAM ) {
streamIterator si ;
streamIteratorStart ( & si , o - > ptr , NULL , NULL , 0 ) ;
streamID id ;
int64_t numfields ;
while ( streamIteratorGetID ( & si , & id , & numfields ) ) {
sds itemid = sdscatfmt ( sdsempty ( ) , " %U.%U " , id . ms , id . seq ) ;
mixDigest ( digest , itemid , sdslen ( itemid ) ) ;
sdsfree ( itemid ) ;
while ( numfields - - ) {
unsigned char * field , * value ;
int64_t field_len , value_len ;
streamIteratorGetField ( & si , & field , & value ,
& field_len , & value_len ) ;
mixDigest ( digest , field , field_len ) ;
mixDigest ( digest , value , value_len ) ;
}
}
streamIteratorStop ( & si ) ;
} else if ( o - > type = = OBJ_MODULE ) {
2021-06-16 02:45:49 -04:00
RedisModuleDigest md = { { 0 } , { 0 } , keyobj , db - > id } ;
2018-12-07 10:30:33 -05:00
moduleValue * mv = o - > ptr ;
moduleType * mt = mv - > type ;
moduleInitDigestContext ( md ) ;
if ( mt - > digest ) {
mt - > digest ( & md , mv - > value ) ;
xorDigest ( digest , md . x , sizeof ( md . x ) ) ;
}
} else {
serverPanic ( " Unknown object type " ) ;
}
/* If the key has an expire, add it to the mix */
if ( expiretime ! = - 1 ) xorDigest ( digest , " !!expire!! " , 10 ) ;
}
2010-06-21 18:07:48 -04:00
/* Compute the dataset digest. Since keys, sets elements, hashes elements
* are not ordered , we use a trick : every aggregate digest is the xor
* of the digests of their elements . This way the order will not change
* the result . For list instead we use a feedback entering the output digest
* as input in order to ensure that a different ordered list will result in
* a different digest . */
void computeDatasetDigest ( unsigned char * final ) {
unsigned char digest [ 20 ] ;
dictIterator * di = NULL ;
dictEntry * de ;
int j ;
uint32_t aux ;
memset ( final , 0 , 20 ) ; /* Start with a clean result */
for ( j = 0 ; j < server . dbnum ; j + + ) {
redisDb * db = server . db + j ;
if ( dictSize ( db - > dict ) = = 0 ) continue ;
2016-12-24 10:27:58 -05:00
di = dictGetSafeIterator ( db - > dict ) ;
2010-06-21 18:07:48 -04:00
/* hash the DB id, so the same dataset moved in a different
* DB will lead to a different digest */
aux = htonl ( j ) ;
mixDigest ( final , & aux , sizeof ( aux ) ) ;
/* Iterate this DB writing every entry */
while ( ( de = dictNext ( di ) ) ! = NULL ) {
sds key ;
robj * keyobj , * o ;
memset ( digest , 0 , 20 ) ; /* This key-val digest */
2011-11-08 11:07:55 -05:00
key = dictGetKey ( de ) ;
2010-06-21 18:07:48 -04:00
keyobj = createStringObject ( key , sdslen ( key ) ) ;
mixDigest ( digest , key , sdslen ( key ) ) ;
2011-11-08 11:07:55 -05:00
o = dictGetVal ( de ) ;
2018-12-07 10:30:33 -05:00
xorObjectDigest ( db , keyobj , digest , o ) ;
2010-06-21 18:07:48 -04:00
/* We can finally xor the key-val digest to the final digest */
xorDigest ( final , digest , 20 ) ;
decrRefCount ( keyobj ) ;
}
dictReleaseIterator ( di ) ;
}
}
2019-05-30 05:51:32 -04:00
# ifdef USE_JEMALLOC
void mallctl_int ( client * c , robj * * argv , int argc ) {
int ret ;
/* start with the biggest size (int64), and if that fails, try smaller sizes (int32, bool) */
int64_t old = 0 , val ;
if ( argc > 1 ) {
long long ll ;
if ( getLongLongFromObjectOrReply ( c , argv [ 1 ] , & ll , NULL ) ! = C_OK )
return ;
val = ll ;
}
size_t sz = sizeof ( old ) ;
while ( sz > 0 ) {
if ( ( ret = je_mallctl ( argv [ 0 ] - > ptr , & old , & sz , argc > 1 ? & val : NULL , argc > 1 ? sz : 0 ) ) ) {
2020-05-17 08:10:25 -04:00
if ( ret = = EPERM & & argc > 1 ) {
/* if this option is write only, try just writing to it. */
if ( ! ( ret = je_mallctl ( argv [ 0 ] - > ptr , NULL , 0 , & val , sz ) ) ) {
addReply ( c , shared . ok ) ;
return ;
}
}
2019-05-30 05:51:32 -04:00
if ( ret = = EINVAL ) {
/* size might be wrong, try a smaller one */
sz / = 2 ;
# if BYTE_ORDER == BIG_ENDIAN
val < < = 8 * sz ;
# endif
continue ;
}
addReplyErrorFormat ( c , " %s " , strerror ( ret ) ) ;
return ;
} else {
# if BYTE_ORDER == BIG_ENDIAN
old > > = 64 - 8 * sz ;
# endif
addReplyLongLong ( c , old ) ;
return ;
}
}
addReplyErrorFormat ( c , " %s " , strerror ( EINVAL ) ) ;
}
void mallctl_string ( client * c , robj * * argv , int argc ) {
2020-05-17 08:10:25 -04:00
int rret , wret ;
2019-05-30 05:51:32 -04:00
char * old ;
size_t sz = sizeof ( old ) ;
/* for strings, it seems we need to first get the old value, before overriding it. */
2020-05-17 08:10:25 -04:00
if ( ( rret = je_mallctl ( argv [ 0 ] - > ptr , & old , & sz , NULL , 0 ) ) ) {
/* return error unless this option is write only. */
if ( ! ( rret = = EPERM & & argc > 1 ) ) {
addReplyErrorFormat ( c , " %s " , strerror ( rret ) ) ;
return ;
}
}
if ( argc > 1 ) {
char * val = argv [ 1 ] - > ptr ;
char * * valref = & val ;
if ( ( ! strcmp ( val , " VOID " ) ) )
valref = NULL , sz = 0 ;
wret = je_mallctl ( argv [ 0 ] - > ptr , NULL , 0 , valref , sz ) ;
2019-05-30 05:51:32 -04:00
}
2020-05-17 08:10:25 -04:00
if ( ! rret )
addReplyBulkCString ( c , old ) ;
else if ( wret )
addReplyErrorFormat ( c , " %s " , strerror ( wret ) ) ;
else
addReply ( c , shared . ok ) ;
2019-05-30 05:51:32 -04:00
}
# endif
2015-07-26 09:20:46 -04:00
void debugCommand ( client * c ) {
2017-11-27 10:57:44 -05:00
if ( c - > argc = = 2 & & ! strcasecmp ( c - > argv [ 1 ] - > ptr , " help " ) ) {
const char * help [ ] = {
2021-01-04 10:02:57 -05:00
" AOF-FLUSH-SLEEP <microsec> " ,
" Server will sleep before flushing the AOF, this is used for testing. " ,
" ASSERT " ,
" Crash by assertion failed. " ,
2021-06-20 02:46:27 -04:00
" CHANGE-REPL-ID " ,
2021-01-04 10:02:57 -05:00
" Change the replication IDs of the instance. " ,
" Dangerous: should be used only for testing the replication subsystem. " ,
" CONFIG-REWRITE-FORCE-ALL " ,
" Like CONFIG REWRITE but writes all configuration options, including " ,
" keywords not listed in original configuration file or default values. " ,
2021-06-20 02:46:27 -04:00
" CRASH-AND-RECOVER [<milliseconds>] " ,
" Hard crash and restart after a <milliseconds> delay (default 0). " ,
2021-01-04 10:02:57 -05:00
" DIGEST " ,
" Output a hex signature representing the current DB content. " ,
" DIGEST-VALUE <key> [<key> ...] " ,
" Output a hex signature of the values of all the specified keys. " ,
" ERROR <string> " ,
" Return a Redis protocol error with <string> as message. Useful for clients " ,
" unit tests to simulate Redis errors. " ,
2021-06-20 02:46:27 -04:00
" LEAK <string> " ,
" Create a memory leak of the input string. " ,
2021-01-04 10:02:57 -05:00
" LOG <message> " ,
" Write <message> to the server log. " ,
" HTSTATS <dbid> " ,
" Return hash table statistics of the specified Redis database. " ,
" HTSTATS-KEY <key> " ,
" Like HTSTATS but for the hash table stored at <key>'s value. " ,
" LOADAOF " ,
" Flush the AOF buffers on disk and reload the AOF in memory. " ,
" LUA-ALWAYS-REPLICATE-COMMANDS <0|1> " ,
" Setting it to 1 makes Lua replication defaulting to replicating single " ,
" commands, without the script having to enable effects replication. " ,
2019-05-30 05:51:32 -04:00
# ifdef USE_JEMALLOC
2021-01-04 10:02:57 -05:00
" MALLCTL <key> [<val>] " ,
" Get or set a malloc tuning integer. " ,
" MALLCTL-STR <key> [<val>] " ,
" Get or set a malloc tuning string. " ,
2019-05-30 05:51:32 -04:00
# endif
2021-01-04 10:02:57 -05:00
" OBJECT <key> " ,
" Show low level info about `key` and associated value. " ,
" OOM " ,
" Crash the server simulating an out-of-memory error. " ,
" PANIC " ,
" Crash the server simulating a panic. " ,
" POPULATE <count> [<prefix>] [<size>] " ,
" Create <count> string keys named key:<num>. If <prefix> is specified then " ,
" it is used instead of the 'key' prefix. " ,
2021-06-20 02:46:27 -04:00
" PROTOCOL <type> " ,
2021-01-04 10:02:57 -05:00
" Reply with a test value of the specified type. <type> can be: string, " ,
" integer, double, bignum, null, array, set, map, attrib, push, verbatim, " ,
" true, false. " ,
" RELOAD [option ...] " ,
" Save the RDB on disk and reload it back to memory. Valid <option> values: " ,
" * MERGE: conflicting keys will be loaded from RDB. " ,
" * NOFLUSH: the existing database will not be removed before load, but " ,
2021-06-20 02:46:27 -04:00
" conflicting keys will generate an exception and kill the server. " ,
2021-01-04 10:02:57 -05:00
" * NOSAVE: the database will be loaded from an existing RDB file. " ,
" Examples: " ,
2021-03-24 05:11:38 -04:00
" * DEBUG RELOAD: verify that the server is able to persist, flush and reload " ,
2021-01-04 10:02:57 -05:00
" the database. " ,
" * DEBUG RELOAD NOSAVE: replace the current database with the contents of an " ,
" existing RDB file. " ,
" * DEBUG RELOAD NOSAVE NOFLUSH MERGE: add the contents of an existing RDB " ,
" file to the database. " ,
2021-06-20 02:46:27 -04:00
" RESTART [<milliseconds>] " ,
" Graceful restart: save config, db, restart after a <milliseconds> delay (default 0). " ,
2021-01-04 10:02:57 -05:00
" SDSLEN <key> " ,
" Show low level SDS string info representing `key` and value. " ,
" SEGFAULT " ,
" Crash the server with sigsegv. " ,
" SET-ACTIVE-EXPIRE <0|1> " ,
" Setting it to 0 disables expiring keys in background when they are not " ,
" accessed (otherwise the Redis behavior). Setting it to 1 reenables back the " ,
" default. " ,
" SET-SKIP-CHECKSUM-VALIDATION <0|1> " ,
" Enables or disables checksum checks for RDB files and RESTORE's payload. " ,
" SLEEP <seconds> " ,
" Stop the server for <seconds>. Decimals allowed. " ,
" STRINGMATCH-TEST " ,
" Run a fuzz tester against the stringmatchlen() function. " ,
" STRUCTSIZE " ,
" Return the size of different Redis core C structures. " ,
" ZIPLIST <key> " ,
" Show low level info about the ziplist encoding of <key>. " ,
2017-12-06 06:05:11 -05:00
NULL
2017-11-27 10:57:44 -05:00
} ;
addReplyHelp ( c , help ) ;
2016-05-04 06:45:55 -04:00
} else if ( ! strcasecmp ( c - > argv [ 1 ] - > ptr , " segfault " ) ) {
2010-06-21 18:07:48 -04:00
* ( ( char * ) - 1 ) = ' x ' ;
2017-01-18 11:05:10 -05:00
} else if ( ! strcasecmp ( c - > argv [ 1 ] - > ptr , " panic " ) ) {
2021-03-17 09:45:38 -04:00
serverPanic ( " DEBUG PANIC called at Unix time %lld " , ( long long ) time ( NULL ) ) ;
2015-10-13 05:08:24 -04:00
} else if ( ! strcasecmp ( c - > argv [ 1 ] - > ptr , " restart " ) | |
! strcasecmp ( c - > argv [ 1 ] - > ptr , " crash-and-recover " ) )
{
long long delay = 0 ;
if ( c - > argc > = 3 ) {
if ( getLongLongFromObjectOrReply ( c , c - > argv [ 2 ] , & delay , NULL )
! = C_OK ) return ;
if ( delay < 0 ) delay = 0 ;
}
int flags = ! strcasecmp ( c - > argv [ 1 ] - > ptr , " restart " ) ?
( RESTART_SERVER_GRACEFULLY | RESTART_SERVER_CONFIG_REWRITE ) :
RESTART_SERVER_NONE ;
restartServer ( flags , delay ) ;
addReplyError ( c , " failed to restart the server. Check server logs. " ) ;
2012-08-24 06:55:37 -04:00
} else if ( ! strcasecmp ( c - > argv [ 1 ] - > ptr , " oom " ) ) {
void * ptr = zmalloc ( ULONG_MAX ) ; /* Should trigger an out of memory. */
zfree ( ptr ) ;
addReply ( c , shared . ok ) ;
2011-10-04 11:22:29 -04:00
} else if ( ! strcasecmp ( c - > argv [ 1 ] - > ptr , " assert " ) ) {
2015-07-26 09:29:53 -04:00
serverAssertWithInfo ( c , c - > argv [ 0 ] , 1 = = 2 ) ;
2018-07-29 03:08:47 -04:00
} else if ( ! strcasecmp ( c - > argv [ 1 ] - > ptr , " log " ) & & c - > argc = = 3 ) {
serverLog ( LL_WARNING , " DEBUG LOG: %s " , ( char * ) c - > argv [ 2 ] - > ptr ) ;
addReply ( c , shared . ok ) ;
tests/valgrind: don't use debug restart (#7404)
* tests/valgrind: don't use debug restart
DEBUG REATART causes two issues:
1. it uses execve which replaces the original process and valgrind doesn't
have a chance to check for errors, so leaks go unreported.
2. valgrind report invalid calls to close() which we're unable to resolve.
So now the tests use restart_server mechanism in the tests, that terminates
the old server and starts a new one, new PID, but same stdout, stderr.
since the stderr can contain two or more valgrind report, it is not enough
to just check for the absence of leaks, we also need to check for some known
errors, we do both, and fail if we either find an error, or can't find a
report saying there are no leaks.
other changes:
- when killing a server that was already terminated we check for leaks too.
- adding DEBUG LEAK which was used to test it.
- adding --trace-children to valgrind, although no longer needed.
- since the stdout contains two or more runs, we need slightly different way
of checking if the new process is up (explicitly looking for the new PID)
- move the code that handles --wait-server to happen earlier (before
watching the startup message in the log), and serve the restarted server too.
* squashme - CR fixes
2020-07-10 01:26:52 -04:00
} else if ( ! strcasecmp ( c - > argv [ 1 ] - > ptr , " leak " ) & & c - > argc = = 3 ) {
sdsdup ( c - > argv [ 2 ] - > ptr ) ;
addReply ( c , shared . ok ) ;
2010-06-21 18:07:48 -04:00
} else if ( ! strcasecmp ( c - > argv [ 1 ] - > ptr , " reload " ) ) {
2020-04-09 06:02:27 -04:00
int flush = 1 , save = 1 ;
int flags = RDBFLAGS_NONE ;
/* Parse the additional options that modify the RELOAD
* behavior . */
for ( int j = 2 ; j < c - > argc ; j + + ) {
char * opt = c - > argv [ j ] - > ptr ;
if ( ! strcasecmp ( opt , " MERGE " ) ) {
flags | = RDBFLAGS_ALLOW_DUP ;
} else if ( ! strcasecmp ( opt , " NOFLUSH " ) ) {
flush = 0 ;
} else if ( ! strcasecmp ( opt , " NOSAVE " ) ) {
save = 0 ;
} else {
addReplyError ( c , " DEBUG RELOAD only supports the "
" MERGE, NOFLUSH and NOSAVE options. " ) ;
return ;
}
2010-06-21 18:07:48 -04:00
}
2020-04-09 06:02:27 -04:00
Squash merging 125 typo/grammar/comment/doc PRs (#7773)
List of squashed commits or PRs
===============================
commit 66801ea
Author: hwware <wen.hui.ware@gmail.com>
Date: Mon Jan 13 00:54:31 2020 -0500
typo fix in acl.c
commit 46f55db
Author: Itamar Haber <itamar@redislabs.com>
Date: Sun Sep 6 18:24:11 2020 +0300
Updates a couple of comments
Specifically:
* RM_AutoMemory completed instead of pointing to docs
* Updated link to custom type doc
commit 61a2aa0
Author: xindoo <xindoo@qq.com>
Date: Tue Sep 1 19:24:59 2020 +0800
Correct errors in code comments
commit a5871d1
Author: yz1509 <pro-756@qq.com>
Date: Tue Sep 1 18:36:06 2020 +0800
fix typos in module.c
commit 41eede7
Author: bookug <bookug@qq.com>
Date: Sat Aug 15 01:11:33 2020 +0800
docs: fix typos in comments
commit c303c84
Author: lazy-snail <ws.niu@outlook.com>
Date: Fri Aug 7 11:15:44 2020 +0800
fix spelling in redis.conf
commit 1eb76bf
Author: zhujian <zhujianxyz@gmail.com>
Date: Thu Aug 6 15:22:10 2020 +0800
add a missing 'n' in comment
commit 1530ec2
Author: Daniel Dai <764122422@qq.com>
Date: Mon Jul 27 00:46:35 2020 -0400
fix spelling in tracking.c
commit e517b31
Author: Hunter-Chen <huntcool001@gmail.com>
Date: Fri Jul 17 22:33:32 2020 +0800
Update redis.conf
Co-authored-by: Itamar Haber <itamar@redislabs.com>
commit c300eff
Author: Hunter-Chen <huntcool001@gmail.com>
Date: Fri Jul 17 22:33:23 2020 +0800
Update redis.conf
Co-authored-by: Itamar Haber <itamar@redislabs.com>
commit 4c058a8
Author: 陈浩鹏 <chenhaopeng@heytea.com>
Date: Thu Jun 25 19:00:56 2020 +0800
Grammar fix and clarification
commit 5fcaa81
Author: bodong.ybd <bodong.ybd@alibaba-inc.com>
Date: Fri Jun 19 10:09:00 2020 +0800
Fix typos
commit 4caca9a
Author: Pruthvi P <pruthvi@ixigo.com>
Date: Fri May 22 00:33:22 2020 +0530
Fix typo eviciton => eviction
commit b2a25f6
Author: Brad Dunbar <dunbarb2@gmail.com>
Date: Sun May 17 12:39:59 2020 -0400
Fix a typo.
commit 12842ae
Author: hwware <wen.hui.ware@gmail.com>
Date: Sun May 3 17:16:59 2020 -0400
fix spelling in redis conf
commit ddba07c
Author: Chris Lamb <chris@chris-lamb.co.uk>
Date: Sat May 2 23:25:34 2020 +0100
Correct a "conflicts" spelling error.
commit 8fc7bf2
Author: Nao YONASHIRO <yonashiro@r.recruit.co.jp>
Date: Thu Apr 30 10:25:27 2020 +0900
docs: fix EXPIRE_FAST_CYCLE_DURATION to ACTIVE_EXPIRE_CYCLE_FAST_DURATION
commit 9b2b67a
Author: Brad Dunbar <dunbarb2@gmail.com>
Date: Fri Apr 24 11:46:22 2020 -0400
Fix a typo.
commit 0746f10
Author: devilinrust <63737265+devilinrust@users.noreply.github.com>
Date: Thu Apr 16 00:17:53 2020 +0200
Fix typos in server.c
commit 92b588d
Author: benjessop12 <56115861+benjessop12@users.noreply.github.com>
Date: Mon Apr 13 13:43:55 2020 +0100
Fix spelling mistake in lazyfree.c
commit 1da37aa
Merge: 2d4ba28 af347a8
Author: hwware <wen.hui.ware@gmail.com>
Date: Thu Mar 5 22:41:31 2020 -0500
Merge remote-tracking branch 'upstream/unstable' into expiretypofix
commit 2d4ba28
Author: hwware <wen.hui.ware@gmail.com>
Date: Mon Mar 2 00:09:40 2020 -0500
fix typo in expire.c
commit 1a746f7
Author: SennoYuki <minakami1yuki@gmail.com>
Date: Thu Feb 27 16:54:32 2020 +0800
fix typo
commit 8599b1a
Author: dongheejeong <donghee950403@gmail.com>
Date: Sun Feb 16 20:31:43 2020 +0000
Fix typo in server.c
commit f38d4e8
Author: hwware <wen.hui.ware@gmail.com>
Date: Sun Feb 2 22:58:38 2020 -0500
fix typo in evict.c
commit fe143fc
Author: Leo Murillo <leonardo.murillo@gmail.com>
Date: Sun Feb 2 01:57:22 2020 -0600
Fix a few typos in redis.conf
commit 1ab4d21
Author: viraja1 <anchan.viraj@gmail.com>
Date: Fri Dec 27 17:15:58 2019 +0530
Fix typo in Latency API docstring
commit ca1f70e
Author: gosth <danxuedexing@qq.com>
Date: Wed Dec 18 15:18:02 2019 +0800
fix typo in sort.c
commit a57c06b
Author: ZYunH <zyunhjob@163.com>
Date: Mon Dec 16 22:28:46 2019 +0800
fix-zset-typo
commit b8c92b5
Author: git-hulk <hulk.website@gmail.com>
Date: Mon Dec 16 15:51:42 2019 +0800
FIX: typo in cluster.c, onformation->information
commit 9dd981c
Author: wujm2007 <jim.wujm@gmail.com>
Date: Mon Dec 16 09:37:52 2019 +0800
Fix typo
commit e132d7a
Author: Sebastien Williams-Wynn <s.williamswynn.mail@gmail.com>
Date: Fri Nov 15 00:14:07 2019 +0000
Minor typo change
commit 47f44d5
Author: happynote3966 <01ssrmikururudevice01@gmail.com>
Date: Mon Nov 11 22:08:48 2019 +0900
fix comment typo in redis-cli.c
commit b8bdb0d
Author: fulei <fulei@kuaishou.com>
Date: Wed Oct 16 18:00:17 2019 +0800
Fix a spelling mistake of comments in defragDictBucketCallback
commit 0def46a
Author: fulei <fulei@kuaishou.com>
Date: Wed Oct 16 13:09:27 2019 +0800
fix some spelling mistakes of comments in defrag.c
commit f3596fd
Author: Phil Rajchgot <tophil@outlook.com>
Date: Sun Oct 13 02:02:32 2019 -0400
Typo and grammar fixes
Redis and its documentation are great -- just wanted to submit a few corrections in the spirit of Hacktoberfest. Thanks for all your work on this project. I use it all the time and it works beautifully.
commit 2b928cd
Author: KangZhiDong <worldkzd@gmail.com>
Date: Sun Sep 1 07:03:11 2019 +0800
fix typos
commit 33aea14
Author: Axlgrep <axlgrep@gmail.com>
Date: Tue Aug 27 11:02:18 2019 +0800
Fixed eviction spelling issues
commit e282a80
Author: Simen Flatby <simen@oms.no>
Date: Tue Aug 20 15:25:51 2019 +0200
Update comments to reflect prop name
In the comments the prop is referenced as replica-validity-factor,
but it is really named cluster-replica-validity-factor.
commit 74d1f9a
Author: Jim Green <jimgreen2013@qq.com>
Date: Tue Aug 20 20:00:31 2019 +0800
fix comment error, the code is ok
commit eea1407
Author: Liao Tonglang <liaotonglang@gmail.com>
Date: Fri May 31 10:16:18 2019 +0800
typo fix
fix cna't to can't
commit 0da553c
Author: KAWACHI Takashi <tkawachi@gmail.com>
Date: Wed Jul 17 00:38:16 2019 +0900
Fix typo
commit 7fc8fb6
Author: Michael Prokop <mika@grml.org>
Date: Tue May 28 17:58:42 2019 +0200
Typo fixes
s/familar/familiar/
s/compatiblity/compatibility/
s/ ot / to /
s/itsef/itself/
commit 5f46c9d
Author: zhumoing <34539422+zhumoing@users.noreply.github.com>
Date: Tue May 21 21:16:50 2019 +0800
typo-fixes
typo-fixes
commit 321dfe1
Author: wxisme <850885154@qq.com>
Date: Sat Mar 16 15:10:55 2019 +0800
typo fix
commit b4fb131
Merge: 267e0e6 3df1eb8
Author: Nikitas Bastas <nikitasbst@gmail.com>
Date: Fri Feb 8 22:55:45 2019 +0200
Merge branch 'unstable' of antirez/redis into unstable
commit 267e0e6
Author: Nikitas Bastas <nikitasbst@gmail.com>
Date: Wed Jan 30 21:26:04 2019 +0200
Minor typo fix
commit 30544e7
Author: inshal96 <39904558+inshal96@users.noreply.github.com>
Date: Fri Jan 4 16:54:50 2019 +0500
remove an extra 'a' in the comments
commit 337969d
Author: BrotherGao <yangdongheng11@gmail.com>
Date: Sat Dec 29 12:37:29 2018 +0800
fix typo in redis.conf
commit 9f4b121
Merge: 423a030 e504583
Author: BrotherGao <yangdongheng@xiaomi.com>
Date: Sat Dec 29 11:41:12 2018 +0800
Merge branch 'unstable' of antirez/redis into unstable
commit 423a030
Merge: 42b02b7 46a51cd
Author: 杨东衡 <yangdongheng@xiaomi.com>
Date: Tue Dec 4 23:56:11 2018 +0800
Merge branch 'unstable' of antirez/redis into unstable
commit 42b02b7
Merge: 68c0e6e b8febe6
Author: Dongheng Yang <yangdongheng11@gmail.com>
Date: Sun Oct 28 15:54:23 2018 +0800
Merge pull request #1 from antirez/unstable
update local data
commit 714b589
Author: Christian <crifei93@gmail.com>
Date: Fri Dec 28 01:17:26 2018 +0100
fix typo "resulution"
commit e23259d
Author: garenchan <1412950785@qq.com>
Date: Wed Dec 26 09:58:35 2018 +0800
fix typo: segfauls -> segfault
commit a9359f8
Author: xjp <jianping_xie@aliyun.com>
Date: Tue Dec 18 17:31:44 2018 +0800
Fixed REDISMODULE_H spell bug
commit a12c3e4
Author: jdiaz <jrd.palacios@gmail.com>
Date: Sat Dec 15 23:39:52 2018 -0600
Fixes hyperloglog hash function comment block description
commit 770eb11
Author: 林上耀 <1210tom@163.com>
Date: Sun Nov 25 17:16:10 2018 +0800
fix typo
commit fd97fbb
Author: Chris Lamb <chris@chris-lamb.co.uk>
Date: Fri Nov 23 17:14:01 2018 +0100
Correct "unsupported" typo.
commit a85522d
Author: Jungnam Lee <jungnam.lee@oracle.com>
Date: Thu Nov 8 23:01:29 2018 +0900
fix typo in test comments
commit ade8007
Author: Arun Kumar <palerdot@users.noreply.github.com>
Date: Tue Oct 23 16:56:35 2018 +0530
Fixed grammatical typo
Fixed typo for word 'dictionary'
commit 869ee39
Author: Hamid Alaei <hamid.a85@gmail.com>
Date: Sun Aug 12 16:40:02 2018 +0430
fix documentations: (ThreadSafeContextStart/Stop -> ThreadSafeContextLock/Unlock), minor typo
commit f89d158
Author: Mayank Jain <mayankjain255@gmail.com>
Date: Tue Jul 31 23:01:21 2018 +0530
Updated README.md with some spelling corrections.
Made correction in spelling of some misspelled words.
commit 892198e
Author: dsomeshwar <someshwar.dhayalan@gmail.com>
Date: Sat Jul 21 23:23:04 2018 +0530
typo fix
commit 8a4d780
Author: Itamar Haber <itamar@redislabs.com>
Date: Mon Apr 30 02:06:52 2018 +0300
Fixes some typos
commit e3acef6
Author: Noah Rosamilia <ivoahivoah@gmail.com>
Date: Sat Mar 3 23:41:21 2018 -0500
Fix typo in /deps/README.md
commit 04442fb
Author: WuYunlong <xzsyeb@126.com>
Date: Sat Mar 3 10:32:42 2018 +0800
Fix typo in readSyncBulkPayload() comment.
commit 9f36880
Author: WuYunlong <xzsyeb@126.com>
Date: Sat Mar 3 10:20:37 2018 +0800
replication.c comment: run_id -> replid.
commit f866b4a
Author: Francesco 'makevoid' Canessa <makevoid@gmail.com>
Date: Thu Feb 22 22:01:56 2018 +0000
fix comment typo in server.c
commit 0ebc69b
Author: 줍 <jubee0124@gmail.com>
Date: Mon Feb 12 16:38:48 2018 +0900
Fix typo in redis.conf
Fix `five behaviors` to `eight behaviors` in [this sentence ](antirez/redis@unstable/redis.conf#L564)
commit b50a620
Author: martinbroadhurst <martinbroadhurst@users.noreply.github.com>
Date: Thu Dec 28 12:07:30 2017 +0000
Fix typo in valgrind.sup
commit 7d8f349
Author: Peter Boughton <peter@sorcerersisle.com>
Date: Mon Nov 27 19:52:19 2017 +0000
Update CONTRIBUTING; refer doc updates to redis-doc repo.
commit 02dec7e
Author: Klauswk <klauswk1@hotmail.com>
Date: Tue Oct 24 16:18:38 2017 -0200
Fix typo in comment
commit e1efbc8
Author: chenshi <baiwfg2@gmail.com>
Date: Tue Oct 3 18:26:30 2017 +0800
Correct two spelling errors of comments
commit 93327d8
Author: spacewander <spacewanderlzx@gmail.com>
Date: Wed Sep 13 16:47:24 2017 +0800
Update the comment for OBJ_ENCODING_EMBSTR_SIZE_LIMIT's value
The value of OBJ_ENCODING_EMBSTR_SIZE_LIMIT is 44 now instead of 39.
commit 63d361f
Author: spacewander <spacewanderlzx@gmail.com>
Date: Tue Sep 12 15:06:42 2017 +0800
Fix <prevlen> related doc in ziplist.c
According to the definition of ZIP_BIG_PREVLEN and other related code,
the guard of single byte <prevlen> should be 254 instead of 255.
commit ebe228d
Author: hanael80 <hanael80@gmail.com>
Date: Tue Aug 15 09:09:40 2017 +0900
Fix typo
commit 6b696e6
Author: Matt Robenolt <matt@ydekproductions.com>
Date: Mon Aug 14 14:50:47 2017 -0700
Fix typo in LATENCY DOCTOR output
commit a2ec6ae
Author: caosiyang <caosiyang@qiyi.com>
Date: Tue Aug 15 14:15:16 2017 +0800
Fix a typo: form => from
commit 3ab7699
Author: caosiyang <caosiyang@qiyi.com>
Date: Thu Aug 10 18:40:33 2017 +0800
Fix a typo: replicationFeedSlavesFromMaster() => replicationFeedSlavesFromMasterStream()
commit 72d43ef
Author: caosiyang <caosiyang@qiyi.com>
Date: Tue Aug 8 15:57:25 2017 +0800
fix a typo: servewr => server
commit 707c958
Author: Bo Cai <charpty@gmail.com>
Date: Wed Jul 26 21:49:42 2017 +0800
redis-cli.c typo: conut -> count.
Signed-off-by: Bo Cai <charpty@gmail.com>
commit b9385b2
Author: JackDrogon <jack.xsuperman@gmail.com>
Date: Fri Jun 30 14:22:31 2017 +0800
Fix some spell problems
commit 20d9230
Author: akosel <aaronjkosel@gmail.com>
Date: Sun Jun 4 19:35:13 2017 -0500
Fix typo
commit b167bfc
Author: Krzysiek Witkowicz <krzysiekwitkowicz@gmail.com>
Date: Mon May 22 21:32:27 2017 +0100
Fix #4008 small typo in comment
commit 2b78ac8
Author: Jake Clarkson <jacobwclarkson@gmail.com>
Date: Wed Apr 26 15:49:50 2017 +0100
Correct typo in tests/unit/hyperloglog.tcl
commit b0f1cdb
Author: Qi Luo <qiluo-msft@users.noreply.github.com>
Date: Wed Apr 19 14:25:18 2017 -0700
Fix typo
commit a90b0f9
Author: charsyam <charsyam@naver.com>
Date: Thu Mar 16 18:19:53 2017 +0900
fix typos
fix typos
fix typos
commit 8430a79
Author: Richard Hart <richardhart92@gmail.com>
Date: Mon Mar 13 22:17:41 2017 -0400
Fixed log message typo in listenToPort.
commit 481a1c2
Author: Vinod Kumar <kumar003vinod@gmail.com>
Date: Sun Jan 15 23:04:51 2017 +0530
src/db.c: Correct "save" -> "safe" typo
commit 586b4d3
Author: wangshaonan <wshn13@gmail.com>
Date: Wed Dec 21 20:28:27 2016 +0800
Fix typo they->the in helloworld.c
commit c1c4b5e
Author: Jenner <hypxm@qq.com>
Date: Mon Dec 19 16:39:46 2016 +0800
typo error
commit 1ee1a3f
Author: tielei <43289893@qq.com>
Date: Mon Jul 18 13:52:25 2016 +0800
fix some comments
commit 11a41fb
Author: Otto Kekäläinen <otto@seravo.fi>
Date: Sun Jul 3 10:23:55 2016 +0100
Fix spelling in documentation and comments
commit 5fb5d82
Author: francischan <f1ancis621@gmail.com>
Date: Tue Jun 28 00:19:33 2016 +0800
Fix outdated comments about redis.c file.
It should now refer to server.c file.
commit 6b254bc
Author: lmatt-bit <lmatt123n@gmail.com>
Date: Thu Apr 21 21:45:58 2016 +0800
Refine the comment of dictRehashMilliseconds func
SLAVECONF->REPLCONF in comment - by andyli029
commit ee9869f
Author: clark.kang <charsyam@naver.com>
Date: Tue Mar 22 11:09:51 2016 +0900
fix typos
commit f7b3b11
Author: Harisankar H <harisankarh@gmail.com>
Date: Wed Mar 9 11:49:42 2016 +0530
Typo correction: "faield" --> "failed"
Typo correction: "faield" --> "failed"
commit 3fd40fc
Author: Itamar Haber <itamar@redislabs.com>
Date: Thu Feb 25 10:31:51 2016 +0200
Fixes a typo in comments
commit 621c160
Author: Prayag Verma <prayag.verma@gmail.com>
Date: Mon Feb 1 12:36:20 2016 +0530
Fix typo in Readme.md
Spelling mistakes -
`eviciton` > `eviction`
`familar` > `familiar`
commit d7d07d6
Author: WonCheol Lee <toctoc21c@gmail.com>
Date: Wed Dec 30 15:11:34 2015 +0900
Typo fixed
commit a4dade7
Author: Felix Bünemann <buenemann@louis.info>
Date: Mon Dec 28 11:02:55 2015 +0100
[ci skip] Improve supervised upstart config docs
This mentions that "expect stop" is required for supervised upstart
to work correctly. See http://upstart.ubuntu.com/cookbook/#expect-stop
for an explanation.
commit d9caba9
Author: daurnimator <quae@daurnimator.com>
Date: Mon Dec 21 18:30:03 2015 +1100
README: Remove trailing whitespace
commit 72d42e5
Author: daurnimator <quae@daurnimator.com>
Date: Mon Dec 21 18:29:32 2015 +1100
README: Fix typo. th => the
commit dd6e957
Author: daurnimator <quae@daurnimator.com>
Date: Mon Dec 21 18:29:20 2015 +1100
README: Fix typo. familar => familiar
commit 3a12b23
Author: daurnimator <quae@daurnimator.com>
Date: Mon Dec 21 18:28:54 2015 +1100
README: Fix typo. eviciton => eviction
commit 2d1d03b
Author: daurnimator <quae@daurnimator.com>
Date: Mon Dec 21 18:21:45 2015 +1100
README: Fix typo. sever => server
commit 3973b06
Author: Itamar Haber <itamar@garantiadata.com>
Date: Sat Dec 19 17:01:20 2015 +0200
Typo fix
commit 4f2e460
Author: Steve Gao <fu@2token.com>
Date: Fri Dec 4 10:22:05 2015 +0800
Update README - fix typos
commit b21667c
Author: binyan <binbin.yan@nokia.com>
Date: Wed Dec 2 22:48:37 2015 +0800
delete redundancy color judge in sdscatcolor
commit 88894c7
Author: binyan <binbin.yan@nokia.com>
Date: Wed Dec 2 22:14:42 2015 +0800
the example output shoule be HelloWorld
commit 2763470
Author: binyan <binbin.yan@nokia.com>
Date: Wed Dec 2 17:41:39 2015 +0800
modify error word keyevente
Signed-off-by: binyan <binbin.yan@nokia.com>
commit 0847b3d
Author: Bruno Martins <bscmartins@gmail.com>
Date: Wed Nov 4 11:37:01 2015 +0000
typo
commit bbb9e9e
Author: dawedawe <dawedawe@gmx.de>
Date: Fri Mar 27 00:46:41 2015 +0100
typo: zimap -> zipmap
commit 5ed297e
Author: Axel Advento <badwolf.bloodseeker.rev@gmail.com>
Date: Tue Mar 3 15:58:29 2015 +0800
Fix 'salve' typos to 'slave'
commit edec9d6
Author: LudwikJaniuk <ludvig.janiuk@gmail.com>
Date: Wed Jun 12 14:12:47 2019 +0200
Update README.md
Co-Authored-By: Qix <Qix-@users.noreply.github.com>
commit 692a7af
Author: LudwikJaniuk <ludvig.janiuk@gmail.com>
Date: Tue May 28 14:32:04 2019 +0200
grammar
commit d962b0a
Author: Nick Frost <nickfrostatx@gmail.com>
Date: Wed Jul 20 15:17:12 2016 -0700
Minor grammar fix
commit 24fff01aaccaf5956973ada8c50ceb1462e211c6 (typos)
Author: Chad Miller <chadm@squareup.com>
Date: Tue Sep 8 13:46:11 2020 -0400
Fix faulty comment about operation of unlink()
commit 3cd5c1f3326c52aa552ada7ec797c6bb16452355
Author: Kevin <kevin.xgr@gmail.com>
Date: Wed Nov 20 00:13:50 2019 +0800
Fix typo in server.c.
From a83af59 Mon Sep 17 00:00:00 2001
From: wuwo <wuwo@wacai.com>
Date: Fri, 17 Mar 2017 20:37:45 +0800
Subject: [PATCH] falure to failure
From c961896 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=B7=A6=E6=87=B6?= <veficos@gmail.com>
Date: Sat, 27 May 2017 15:33:04 +0800
Subject: [PATCH] fix typo
From e600ef2 Mon Sep 17 00:00:00 2001
From: "rui.zou" <rui.zou@yunify.com>
Date: Sat, 30 Sep 2017 12:38:15 +0800
Subject: [PATCH] fix a typo
From c7d07fa Mon Sep 17 00:00:00 2001
From: Alexandre Perrin <alex@kaworu.ch>
Date: Thu, 16 Aug 2018 10:35:31 +0200
Subject: [PATCH] deps README.md typo
From b25cb67 Mon Sep 17 00:00:00 2001
From: Guy Korland <gkorland@gmail.com>
Date: Wed, 26 Sep 2018 10:55:37 +0300
Subject: [PATCH 1/2] fix typos in header
From ad28ca6 Mon Sep 17 00:00:00 2001
From: Guy Korland <gkorland@gmail.com>
Date: Wed, 26 Sep 2018 11:02:36 +0300
Subject: [PATCH 2/2] fix typos
commit 34924cdedd8552466fc22c1168d49236cb7ee915
Author: Adrian Lynch <adi_ady_ade@hotmail.com>
Date: Sat Apr 4 21:59:15 2015 +0100
Typos fixed
commit fd2a1e7
Author: Jan <jsteemann@users.noreply.github.com>
Date: Sat Oct 27 19:13:01 2018 +0200
Fix typos
Fix typos
commit e14e47c1a234b53b0e103c5f6a1c61481cbcbb02
Author: Andy Lester <andy@petdance.com>
Date: Fri Aug 2 22:30:07 2019 -0500
Fix multiple misspellings of "following"
commit 79b948ce2dac6b453fe80995abbcaac04c213d5a
Author: Andy Lester <andy@petdance.com>
Date: Fri Aug 2 22:24:28 2019 -0500
Fix misspelling of create-cluster
commit 1fffde52666dc99ab35efbd31071a4c008cb5a71
Author: Andy Lester <andy@petdance.com>
Date: Wed Jul 31 17:57:56 2019 -0500
Fix typos
commit 204c9ba9651e9e05fd73936b452b9a30be456cfe
Author: Xiaobo Zhu <xiaobo.zhu@shopee.com>
Date: Tue Aug 13 22:19:25 2019 +0800
fix typos
Squashed commit of the following:
commit 1d9aaf8
Author: danmedani <danmedani@gmail.com>
Date: Sun Aug 2 11:40:26 2015 -0700
README typo fix.
Squashed commit of the following:
commit 32bfa7c
Author: Erik Dubbelboer <erik@dubbelboer.com>
Date: Mon Jul 6 21:15:08 2015 +0200
Fixed grammer
Squashed commit of the following:
commit b24f69c
Author: Sisir Koppaka <sisir.koppaka@gmail.com>
Date: Mon Mar 2 22:38:45 2015 -0500
utils/hashtable/rehashing.c: Fix typos
Squashed commit of the following:
commit 4e04082
Author: Erik Dubbelboer <erik@dubbelboer.com>
Date: Mon Mar 23 08:22:21 2015 +0000
Small config file documentation improvements
Squashed commit of the following:
commit acb8773
Author: ctd1500 <ctd1500@gmail.com>
Date: Fri May 8 01:52:48 2015 -0700
Typo and grammar fixes in readme
commit 2eb75b6
Author: ctd1500 <ctd1500@gmail.com>
Date: Fri May 8 01:36:18 2015 -0700
fixed redis.conf comment
Squashed commit of the following:
commit a8249a2
Author: Masahiko Sawada <sawada.mshk@gmail.com>
Date: Fri Dec 11 11:39:52 2015 +0530
Revise correction of typos.
Squashed commit of the following:
commit 3c02028
Author: zhaojun11 <zhaojun11@jd.com>
Date: Wed Jan 17 19:05:28 2018 +0800
Fix typos include two code typos in cluster.c and latency.c
Squashed commit of the following:
commit 9dba47c
Author: q191201771 <191201771@qq.com>
Date: Sat Jan 4 11:31:04 2020 +0800
fix function listCreate comment in adlist.c
Update src/server.c
commit 2c7c2cb536e78dd211b1ac6f7bda00f0f54faaeb
Author: charpty <charpty@gmail.com>
Date: Tue May 1 23:16:59 2018 +0800
server.c typo: modules system dictionary type comment
Signed-off-by: charpty <charpty@gmail.com>
commit a8395323fb63cb59cb3591cb0f0c8edb7c29a680
Author: Itamar Haber <itamar@redislabs.com>
Date: Sun May 6 00:25:18 2018 +0300
Updates test_helper.tcl's help with undocumented options
Specifically:
* Host
* Port
* Client
commit bde6f9ced15755cd6407b4af7d601b030f36d60b
Author: wxisme <850885154@qq.com>
Date: Wed Aug 8 15:19:19 2018 +0800
fix comments in deps files
commit 3172474ba991532ab799ee1873439f3402412331
Author: wxisme <850885154@qq.com>
Date: Wed Aug 8 14:33:49 2018 +0800
fix some comments
commit 01b6f2b6858b5cf2ce4ad5092d2c746e755f53f0
Author: Thor Juhasz <thor@juhasz.pro>
Date: Sun Nov 18 14:37:41 2018 +0100
Minor fixes to comments
Found some parts a little unclear on a first read, which prompted me to have a better look at the file and fix some minor things I noticed.
Fixing minor typos and grammar. There are no changes to configuration options.
These changes are only meant to help the user better understand the explanations to the various configuration options
2020-09-10 06:43:38 -04:00
/* The default behavior is to save the RDB file before loading
2020-04-09 06:02:27 -04:00
* it back . */
if ( save ) {
rdbSaveInfo rsi , * rsiptr ;
rsiptr = rdbPopulateSaveInfo ( & rsi ) ;
if ( rdbSave ( server . rdb_filename , rsiptr ) ! = C_OK ) {
2020-12-23 22:06:25 -05:00
addReplyErrorObject ( c , shared . err ) ;
2020-04-09 06:02:27 -04:00
return ;
}
}
/* The default behavior is to remove the current dataset from
* memory before loading the RDB file , however when MERGE is
* used together with NOFLUSH , we are able to merge two datasets . */
if ( flush ) emptyDb ( - 1 , EMPTYDB_NO_FLAGS , NULL ) ;
2018-10-09 07:18:25 -04:00
protectClient ( c ) ;
2020-04-09 06:02:27 -04:00
int ret = rdbLoad ( server . rdb_filename , NULL , flags ) ;
2018-10-09 07:18:25 -04:00
unprotectClient ( c ) ;
2018-03-29 11:20:58 -04:00
if ( ret ! = C_OK ) {
2011-10-14 08:30:41 -04:00
addReplyError ( c , " Error trying to load the RDB dump " ) ;
2010-06-21 18:07:48 -04:00
return ;
}
2015-07-27 03:41:48 -04:00
serverLog ( LL_WARNING , " DB reloaded by DEBUG RELOAD " ) ;
2010-06-21 18:07:48 -04:00
addReply ( c , shared . ok ) ;
} else if ( ! strcasecmp ( c - > argv [ 1 ] - > ptr , " loadaof " ) ) {
2018-06-18 11:09:00 -04:00
if ( server . aof_state ! = AOF_OFF ) flushAppendOnlyFile ( 1 ) ;
2015-09-28 04:47:45 -04:00
emptyDb ( - 1 , EMPTYDB_NO_FLAGS , NULL ) ;
2018-10-09 07:18:25 -04:00
protectClient ( c ) ;
2018-03-29 11:20:58 -04:00
int ret = loadAppendOnlyFile ( server . aof_filename ) ;
2021-06-14 03:38:08 -04:00
if ( ret ! = AOF_OK & & ret ! = AOF_EMPTY )
exit ( 1 ) ;
2018-10-09 07:18:25 -04:00
unprotectClient ( c ) ;
2011-12-20 11:52:57 -05:00
server . dirty = 0 ; /* Prevent AOF / replication */
2015-07-27 03:41:48 -04:00
serverLog ( LL_WARNING , " Append Only File loaded by DEBUG LOADAOF " ) ;
2010-06-21 18:07:48 -04:00
addReply ( c , shared . ok ) ;
} else if ( ! strcasecmp ( c - > argv [ 1 ] - > ptr , " object " ) & & c - > argc = = 3 ) {
2011-01-07 20:06:01 -05:00
dictEntry * de ;
2010-06-21 18:07:48 -04:00
robj * val ;
2010-12-29 10:58:57 -05:00
char * strenc ;
2010-06-21 18:07:48 -04:00
2011-01-07 20:06:01 -05:00
if ( ( de = dictFind ( c - > db - > dict , c - > argv [ 2 ] - > ptr ) ) = = NULL ) {
2020-12-23 22:06:25 -05:00
addReplyErrorObject ( c , shared . nokeyerr ) ;
2010-06-21 18:07:48 -04:00
return ;
}
2011-11-08 11:07:55 -05:00
val = dictGetVal ( de ) ;
2010-12-29 10:58:57 -05:00
strenc = strEncoding ( val - > encoding ) ;
2011-01-01 15:35:56 -05:00
2017-12-02 22:51:35 -05:00
char extra [ 138 ] = { 0 } ;
2015-07-26 09:28:00 -04:00
if ( val - > encoding = = OBJ_ENCODING_QUICKLIST ) {
2014-12-10 22:54:19 -05:00
char * nextra = extra ;
int remaining = sizeof ( extra ) ;
quicklist * ql = val - > ptr ;
2014-12-19 10:41:52 -05:00
/* Add number of quicklist nodes */
2017-12-02 22:51:35 -05:00
int used = snprintf ( nextra , remaining , " ql_nodes:%lu " , ql - > len ) ;
2014-12-10 22:54:19 -05:00
nextra + = used ;
remaining - = used ;
2014-12-19 10:41:52 -05:00
/* Add average quicklist fill factor */
double avg = ( double ) ql - > count / ql - > len ;
used = snprintf ( nextra , remaining , " ql_avg_node:%.2f " , avg ) ;
nextra + = used ;
remaining - = used ;
/* Add quicklist fill level / max ziplist size */
used = snprintf ( nextra , remaining , " ql_ziplist_max:%d " , ql - > fill ) ;
nextra + = used ;
remaining - = used ;
/* Add isCompressed? */
int compressed = ql - > compress ! = 0 ;
used = snprintf ( nextra , remaining , " ql_compressed:%d " , compressed ) ;
nextra + = used ;
remaining - = used ;
/* Add total uncompressed size */
unsigned long sz = 0 ;
for ( quicklistNode * node = ql - > head ; node ; node = node - > next ) {
sz + = node - > sz ;
}
used = snprintf ( nextra , remaining , " ql_uncompressed_size:%lu " , sz ) ;
nextra + = used ;
remaining - = used ;
2014-12-10 22:54:19 -05:00
}
2010-12-29 10:58:57 -05:00
addReplyStatusFormat ( c ,
" Value at:%p refcount:%d "
2015-01-18 15:54:30 -05:00
" encoding:%s serializedlength:%zu "
2014-12-10 22:54:19 -05:00
" lru:%d lru_seconds_idle:%llu%s " ,
2010-12-29 10:58:57 -05:00
( void * ) val , val - > refcount ,
2021-06-16 02:45:49 -04:00
strenc , rdbSavedObjectLen ( val , c - > argv [ 2 ] , c - > db - > id ) ,
2014-12-10 22:54:19 -05:00
val - > lru , estimateObjectIdleTime ( val ) / 1000 , extra ) ;
2013-08-27 05:52:12 -04:00
} else if ( ! strcasecmp ( c - > argv [ 1 ] - > ptr , " sdslen " ) & & c - > argc = = 3 ) {
dictEntry * de ;
robj * val ;
sds key ;
if ( ( de = dictFind ( c - > db - > dict , c - > argv [ 2 ] - > ptr ) ) = = NULL ) {
2020-12-23 22:06:25 -05:00
addReplyErrorObject ( c , shared . nokeyerr ) ;
2013-08-27 05:52:12 -04:00
return ;
}
val = dictGetVal ( de ) ;
key = dictGetKey ( de ) ;
2015-07-26 09:28:00 -04:00
if ( val - > type ! = OBJ_STRING | | ! sdsEncodedObject ( val ) ) {
2013-08-27 05:52:12 -04:00
addReplyError ( c , " Not an sds encoded string. " ) ;
} else {
addReplyStatusFormat ( c ,
2016-05-18 01:08:43 -04:00
" key_sds_len:%lld, key_sds_avail:%lld, key_zmalloc: %lld, "
" val_sds_len:%lld, val_sds_avail:%lld, val_zmalloc: %lld " ,
2013-08-27 05:52:12 -04:00
( long long ) sdslen ( key ) ,
( long long ) sdsavail ( key ) ,
2016-05-18 01:08:43 -04:00
( long long ) sdsZmallocSize ( key ) ,
2013-08-27 05:52:12 -04:00
( long long ) sdslen ( val - > ptr ) ,
2016-05-18 01:08:43 -04:00
( long long ) sdsavail ( val - > ptr ) ,
( long long ) getStringObjectSdsUsedMemory ( val ) ) ;
2013-08-27 05:52:12 -04:00
}
2016-12-16 03:02:50 -05:00
} else if ( ! strcasecmp ( c - > argv [ 1 ] - > ptr , " ziplist " ) & & c - > argc = = 3 ) {
robj * o ;
if ( ( o = objectCommandLookupOrReply ( c , c - > argv [ 2 ] , shared . nokeyerr ) )
= = NULL ) return ;
if ( o - > encoding ! = OBJ_ENCODING_ZIPLIST ) {
2020-09-02 16:27:48 -04:00
addReplyError ( c , " Not a ziplist encoded object. " ) ;
2016-12-16 03:02:50 -05:00
} else {
ziplistRepr ( o - > ptr ) ;
addReplyStatus ( c , " Ziplist structure printed on stdout " ) ;
}
2014-09-25 11:01:56 -04:00
} else if ( ! strcasecmp ( c - > argv [ 1 ] - > ptr , " populate " ) & &
2016-12-29 20:37:52 -05:00
c - > argc > = 3 & & c - > argc < = 5 ) {
2010-06-21 18:07:48 -04:00
long keys , j ;
robj * key , * val ;
char buf [ 128 ] ;
2020-11-05 12:58:54 -05:00
if ( getPositiveLongFromObjectOrReply ( c , c - > argv [ 2 ] , & keys , NULL ) ! = C_OK )
2010-06-21 18:07:48 -04:00
return ;
2020-11-05 12:58:54 -05:00
2014-05-09 09:02:29 -04:00
dictExpand ( c - > db - > dict , keys ) ;
2020-07-28 15:05:48 -04:00
long valsize = 0 ;
2020-11-05 12:58:54 -05:00
if ( c - > argc = = 5 & & getPositiveLongFromObjectOrReply ( c , c - > argv [ 4 ] , & valsize , NULL ) ! = C_OK )
2020-07-28 15:05:48 -04:00
return ;
2020-11-05 12:58:54 -05:00
2010-06-21 18:07:48 -04:00
for ( j = 0 ; j < keys ; j + + ) {
2014-09-25 11:01:56 -04:00
snprintf ( buf , sizeof ( buf ) , " %s:%lu " ,
2014-10-09 05:17:27 -04:00
( c - > argc = = 3 ) ? " key " : ( char * ) c - > argv [ 3 ] - > ptr , j ) ;
2010-06-21 18:07:48 -04:00
key = createStringObject ( buf , strlen ( buf ) ) ;
Better read-only behavior for expired keys in slaves.
Slaves key expire is orchestrated by the master. Sometimes the master
will send the synthesized DEL to expire keys on the slave with a non
trivial delay (when the key is not accessed, only the incremental expiry
algorithm will expire it in background).
During that time, a key is logically expired, but slaves still return
the key if you GET (or whatever) it. This is a bad behavior.
However we can't simply trust the slave view of the key, since we need
the master to be able to send write commands to update the slave data
set, and DELs should only happen when the key is expired in the master
in order to ensure consistency.
However 99.99% of the issues with this behavior is when a client which
is not a master sends a read only command. In this case we are safe and
can consider the key as non existing.
This commit does a few changes in order to make this sane:
1. lookupKeyRead() is modified in order to return NULL if the above
conditions are met.
2. Calls to lookupKeyRead() in commands actually writing to the data set
are repliaced with calls to lookupKeyWrite().
There are redundand checks, so for example, if in "2" something was
overlooked, we should be still safe, since anyway, when the master
writes the behavior is to don't care about what expireIfneeded()
returns.
This commit is related to #1768, #1770, #2131.
2014-12-10 10:10:21 -05:00
if ( lookupKeyWrite ( c - > db , key ) ! = NULL ) {
2010-06-21 18:07:48 -04:00
decrRefCount ( key ) ;
continue ;
}
snprintf ( buf , sizeof ( buf ) , " value:%lu " , j ) ;
2016-12-29 20:37:52 -05:00
if ( valsize = = 0 )
val = createStringObject ( buf , strlen ( buf ) ) ;
else {
2017-01-02 02:42:32 -05:00
int buflen = strlen ( buf ) ;
2016-12-29 20:37:52 -05:00
val = createStringObject ( NULL , valsize ) ;
2017-01-02 02:42:32 -05:00
memcpy ( val - > ptr , buf , valsize < = buflen ? valsize : buflen ) ;
2016-12-29 20:37:52 -05:00
}
2010-06-21 18:07:48 -04:00
dbAdd ( c - > db , key , val ) ;
2020-04-21 04:51:46 -04:00
signalModifiedKey ( c , c - > db , key ) ;
2010-06-21 18:07:48 -04:00
decrRefCount ( key ) ;
}
addReply ( c , shared . ok ) ;
} else if ( ! strcasecmp ( c - > argv [ 1 ] - > ptr , " digest " ) & & c - > argc = = 2 ) {
2018-12-07 10:41:54 -05:00
/* DEBUG DIGEST (form without keys specified) */
2010-06-21 18:07:48 -04:00
unsigned char digest [ 20 ] ;
2010-09-02 13:52:24 -04:00
sds d = sdsempty ( ) ;
2010-06-21 18:07:48 -04:00
computeDatasetDigest ( digest ) ;
2018-12-07 10:41:54 -05:00
for ( int i = 0 ; i < 20 ; i + + ) d = sdscatprintf ( d , " %02x " , digest [ i ] ) ;
2010-09-02 13:52:24 -04:00
addReplyStatus ( c , d ) ;
sdsfree ( d ) ;
2018-12-07 10:41:54 -05:00
} else if ( ! strcasecmp ( c - > argv [ 1 ] - > ptr , " digest-value " ) & & c - > argc > = 2 ) {
/* DEBUG DIGEST-VALUE key key key ... key. */
2018-12-07 10:42:49 -05:00
addReplyArrayLen ( c , c - > argc - 2 ) ;
2018-12-07 10:41:54 -05:00
for ( int j = 2 ; j < c - > argc ; j + + ) {
unsigned char digest [ 20 ] ;
memset ( digest , 0 , 20 ) ; /* Start with a clean result */
2020-11-18 04:16:21 -05:00
/* We don't use lookupKey because a debug command should
* work on logically expired keys */
dictEntry * de ;
robj * o = ( ( de = dictFind ( c - > db - > dict , c - > argv [ j ] - > ptr ) ) = = NULL ) ? NULL : dictGetVal ( de ) ;
2018-12-07 10:41:54 -05:00
if ( o ) xorObjectDigest ( c - > db , c - > argv [ j ] , digest , o ) ;
sds d = sdsempty ( ) ;
for ( int i = 0 ; i < 20 ; i + + ) d = sdscatprintf ( d , " %02x " , digest [ i ] ) ;
addReplyStatus ( c , d ) ;
sdsfree ( d ) ;
}
2018-12-10 06:27:18 -05:00
} else if ( ! strcasecmp ( c - > argv [ 1 ] - > ptr , " protocol " ) & & c - > argc = = 3 ) {
/* DEBUG PROTOCOL [string|integer|double|bignum|null|array|set|map|
2020-02-06 03:40:29 -05:00
* attrib | push | verbatim | true | false ] */
2018-12-10 06:27:18 -05:00
char * name = c - > argv [ 2 ] - > ptr ;
2018-12-10 06:31:10 -05:00
if ( ! strcasecmp ( name , " string " ) ) {
2018-12-10 06:27:18 -05:00
addReplyBulkCString ( c , " Hello World " ) ;
2018-12-10 06:31:10 -05:00
} else if ( ! strcasecmp ( name , " integer " ) ) {
2018-12-10 06:27:18 -05:00
addReplyLongLong ( c , 12345 ) ;
2018-12-10 06:31:10 -05:00
} else if ( ! strcasecmp ( name , " double " ) ) {
2018-12-10 06:27:18 -05:00
addReplyDouble ( c , 3.14159265359 ) ;
2018-12-10 06:31:10 -05:00
} else if ( ! strcasecmp ( name , " bignum " ) ) {
2021-07-14 12:14:31 -04:00
addReplyBigNum ( c , " 1234567999999999999999999999999999999 " , 37 ) ;
2018-12-10 06:31:10 -05:00
} else if ( ! strcasecmp ( name , " null " ) ) {
2018-12-10 06:27:18 -05:00
addReplyNull ( c ) ;
2018-12-10 06:31:10 -05:00
} else if ( ! strcasecmp ( name , " array " ) ) {
2018-12-10 06:27:18 -05:00
addReplyArrayLen ( c , 3 ) ;
for ( int j = 0 ; j < 3 ; j + + ) addReplyLongLong ( c , j ) ;
2018-12-10 06:31:10 -05:00
} else if ( ! strcasecmp ( name , " set " ) ) {
2018-12-10 06:27:18 -05:00
addReplySetLen ( c , 3 ) ;
for ( int j = 0 ; j < 3 ; j + + ) addReplyLongLong ( c , j ) ;
2018-12-10 06:31:10 -05:00
} else if ( ! strcasecmp ( name , " map " ) ) {
2018-12-10 06:27:18 -05:00
addReplyMapLen ( c , 3 ) ;
2018-12-10 06:35:28 -05:00
for ( int j = 0 ; j < 3 ; j + + ) {
addReplyLongLong ( c , j ) ;
addReplyBool ( c , j = = 1 ) ;
}
2018-12-10 06:31:10 -05:00
} else if ( ! strcasecmp ( name , " attrib " ) ) {
2021-07-14 12:14:31 -04:00
if ( c - > resp > = 3 ) {
addReplyAttributeLen ( c , 1 ) ;
addReplyBulkCString ( c , " key-popularity " ) ;
addReplyArrayLen ( c , 2 ) ;
addReplyBulkCString ( c , " key:123 " ) ;
addReplyLongLong ( c , 90 ) ;
}
2018-12-10 06:27:18 -05:00
/* Attributes are not real replies, so a well formed reply should
* also have a normal reply type after the attribute . */
addReplyBulkCString ( c , " Some real reply following the attribute " ) ;
2018-12-10 06:31:10 -05:00
} else if ( ! strcasecmp ( name , " push " ) ) {
2018-12-10 06:27:18 -05:00
addReplyPushLen ( c , 2 ) ;
addReplyBulkCString ( c , " server-cpu-usage " ) ;
addReplyLongLong ( c , 42 ) ;
/* Push replies are not synchronous replies, so we emit also a
* normal reply in order for blocking clients just discarding the
* push reply , to actually consume the reply and continue . */
addReplyBulkCString ( c , " Some real reply following the push reply " ) ;
2018-12-10 10:39:27 -05:00
} else if ( ! strcasecmp ( name , " true " ) ) {
addReplyBool ( c , 1 ) ;
} else if ( ! strcasecmp ( name , " false " ) ) {
addReplyBool ( c , 0 ) ;
2018-12-10 10:55:20 -05:00
} else if ( ! strcasecmp ( name , " verbatim " ) ) {
addReplyVerbatim ( c , " This is a verbatim \n string " , 25 , " txt " ) ;
2018-12-10 06:27:18 -05:00
} else {
2020-02-06 03:40:29 -05:00
addReplyError ( c , " Wrong protocol type name. Please use one of the following: string|integer|double|bignum|null|array|set|map|attrib|push|verbatim|true|false " ) ;
2018-12-10 06:27:18 -05:00
}
2011-06-30 07:31:44 -04:00
} else if ( ! strcasecmp ( c - > argv [ 1 ] - > ptr , " sleep " ) & & c - > argc = = 3 ) {
double dtime = strtod ( c - > argv [ 2 ] - > ptr , NULL ) ;
long long utime = dtime * 1000000 ;
2012-07-19 08:37:34 -04:00
struct timespec tv ;
2011-06-30 07:31:44 -04:00
2012-07-19 08:37:34 -04:00
tv . tv_sec = utime / 1000000 ;
tv . tv_nsec = ( utime % 1000000 ) * 1000 ;
nanosleep ( & tv , NULL ) ;
2011-06-30 07:31:44 -04:00
addReply ( c , shared . ok ) ;
2013-03-27 12:55:02 -04:00
} else if ( ! strcasecmp ( c - > argv [ 1 ] - > ptr , " set-active-expire " ) & &
c - > argc = = 3 )
{
server . active_expire_enabled = atoi ( c - > argv [ 2 ] - > ptr ) ;
addReply ( c , shared . ok ) ;
2020-08-14 09:05:34 -04:00
} else if ( ! strcasecmp ( c - > argv [ 1 ] - > ptr , " set-skip-checksum-validation " ) & &
c - > argc = = 3 )
{
server . skip_checksum_validation = atoi ( c - > argv [ 2 ] - > ptr ) ;
addReply ( c , shared . ok ) ;
2019-08-19 05:18:25 -04:00
} else if ( ! strcasecmp ( c - > argv [ 1 ] - > ptr , " aof-flush-sleep " ) & &
c - > argc = = 3 )
{
server . aof_flush_sleep = atoi ( c - > argv [ 2 ] - > ptr ) ;
addReply ( c , shared . ok ) ;
2015-10-30 05:13:04 -04:00
} else if ( ! strcasecmp ( c - > argv [ 1 ] - > ptr , " lua-always-replicate-commands " ) & &
c - > argc = = 3 )
{
server . lua_always_replicate_commands = atoi ( c - > argv [ 2 ] - > ptr ) ;
addReply ( c , shared . ok ) ;
2014-03-10 18:01:55 -04:00
} else if ( ! strcasecmp ( c - > argv [ 1 ] - > ptr , " error " ) & & c - > argc = = 3 ) {
sds errstr = sdsnewlen ( " - " , 1 ) ;
errstr = sdscatsds ( errstr , c - > argv [ 2 ] - > ptr ) ;
errstr = sdsmapchars ( errstr , " \n \r " , " " , 2 ) ; /* no newlines in errors. */
errstr = sdscatlen ( errstr , " \r \n " , 2 ) ;
addReplySds ( c , errstr ) ;
2015-01-23 12:10:14 -05:00
} else if ( ! strcasecmp ( c - > argv [ 1 ] - > ptr , " structsize " ) & & c - > argc = = 2 ) {
sds sizes = sdsempty ( ) ;
2015-07-14 10:04:00 -04:00
sizes = sdscatprintf ( sizes , " bits:%d " , ( sizeof ( void * ) = = 8 ) ? 64 : 32 ) ;
sizes = sdscatprintf ( sizes , " robj:%d " , ( int ) sizeof ( robj ) ) ;
sizes = sdscatprintf ( sizes , " dictentry:%d " , ( int ) sizeof ( dictEntry ) ) ;
2015-07-16 03:14:39 -04:00
sizes = sdscatprintf ( sizes , " sdshdr5:%d " , ( int ) sizeof ( struct sdshdr5 ) ) ;
2015-07-14 10:04:00 -04:00
sizes = sdscatprintf ( sizes , " sdshdr8:%d " , ( int ) sizeof ( struct sdshdr8 ) ) ;
sizes = sdscatprintf ( sizes , " sdshdr16:%d " , ( int ) sizeof ( struct sdshdr16 ) ) ;
sizes = sdscatprintf ( sizes , " sdshdr32:%d " , ( int ) sizeof ( struct sdshdr32 ) ) ;
sizes = sdscatprintf ( sizes , " sdshdr64:%d " , ( int ) sizeof ( struct sdshdr64 ) ) ;
2015-01-23 12:10:14 -05:00
addReplyBulkSds ( c , sizes ) ;
2015-07-14 11:15:37 -04:00
} else if ( ! strcasecmp ( c - > argv [ 1 ] - > ptr , " htstats " ) & & c - > argc = = 3 ) {
long dbid ;
sds stats = sdsempty ( ) ;
char buf [ 4096 ] ;
2020-01-16 17:35:26 -05:00
if ( getLongFromObjectOrReply ( c , c - > argv [ 2 ] , & dbid , NULL ) ! = C_OK ) {
2020-01-16 17:33:23 -05:00
sdsfree ( stats ) ;
2015-07-14 11:15:37 -04:00
return ;
2020-01-16 17:33:23 -05:00
}
2015-07-14 11:15:37 -04:00
if ( dbid < 0 | | dbid > = server . dbnum ) {
2020-01-16 17:33:23 -05:00
sdsfree ( stats ) ;
2015-07-14 11:15:37 -04:00
addReplyError ( c , " Out of range database " ) ;
return ;
}
stats = sdscatprintf ( stats , " [Dictionary HT] \n " ) ;
dictGetStats ( buf , sizeof ( buf ) , server . db [ dbid ] . dict ) ;
stats = sdscat ( stats , buf ) ;
stats = sdscatprintf ( stats , " [Expires HT] \n " ) ;
dictGetStats ( buf , sizeof ( buf ) , server . db [ dbid ] . expires ) ;
stats = sdscat ( stats , buf ) ;
2019-09-18 12:46:11 -04:00
addReplyVerbatim ( c , stats , sdslen ( stats ) , " txt " ) ;
sdsfree ( stats ) ;
2018-06-08 05:17:20 -04:00
} else if ( ! strcasecmp ( c - > argv [ 1 ] - > ptr , " htstats-key " ) & & c - > argc = = 3 ) {
robj * o ;
dict * ht = NULL ;
if ( ( o = objectCommandLookupOrReply ( c , c - > argv [ 2 ] , shared . nokeyerr ) )
= = NULL ) return ;
/* Get the hash table reference from the object, if possible. */
switch ( o - > encoding ) {
case OBJ_ENCODING_SKIPLIST :
{
zset * zs = o - > ptr ;
ht = zs - > dict ;
}
break ;
case OBJ_ENCODING_HT :
ht = o - > ptr ;
break ;
}
if ( ht = = NULL ) {
addReplyError ( c , " The value stored at the specified key is not "
" represented using an hash table " ) ;
} else {
char buf [ 4096 ] ;
dictGetStats ( buf , sizeof ( buf ) , ht ) ;
2019-09-18 12:46:11 -04:00
addReplyVerbatim ( c , buf , strlen ( buf ) , " txt " ) ;
2018-06-08 05:17:20 -04:00
}
2017-12-04 04:24:52 -05:00
} else if ( ! strcasecmp ( c - > argv [ 1 ] - > ptr , " change-repl-id " ) & & c - > argc = = 2 ) {
serverLog ( LL_WARNING , " Changing replication IDs after receiving DEBUG change-repl-id " ) ;
changeReplicationId ( ) ;
clearReplicationId2 ( ) ;
addReply ( c , shared . ok ) ;
2018-12-11 07:29:30 -05:00
} else if ( ! strcasecmp ( c - > argv [ 1 ] - > ptr , " stringmatch-test " ) & & c - > argc = = 2 )
{
stringmatchlen_fuzz_test ( ) ;
addReplyStatus ( c , " Apparently Redis did not crash: test passed " ) ;
2020-09-09 08:43:11 -04:00
} else if ( ! strcasecmp ( c - > argv [ 1 ] - > ptr , " config-rewrite-force-all " ) & & c - > argc = = 2 )
{
if ( rewriteConfig ( server . configfile , 1 ) = = - 1 )
addReplyError ( c , " CONFIG-REWRITE-FORCE-ALL failed " ) ;
else
addReply ( c , shared . ok ) ;
2019-05-30 05:51:32 -04:00
# ifdef USE_JEMALLOC
} else if ( ! strcasecmp ( c - > argv [ 1 ] - > ptr , " mallctl " ) & & c - > argc > = 3 ) {
mallctl_int ( c , c - > argv + 2 , c - > argc - 2 ) ;
return ;
} else if ( ! strcasecmp ( c - > argv [ 1 ] - > ptr , " mallctl-str " ) & & c - > argc > = 3 ) {
mallctl_string ( c , c - > argv + 2 , c - > argc - 2 ) ;
return ;
# endif
2010-06-21 18:07:48 -04:00
} else {
2018-07-02 12:49:34 -04:00
addReplySubcommandSyntaxError ( c ) ;
2017-11-27 10:57:44 -05:00
return ;
2010-06-21 18:07:48 -04:00
}
}
2012-01-20 06:20:45 -05:00
/* =========================== Crash handling ============================== */
2016-06-20 16:08:06 -04:00
void _serverAssert ( const char * estr , const char * file , int line ) {
2011-11-24 09:47:26 -05:00
bugReportStart ( ) ;
2015-07-27 03:41:48 -04:00
serverLog ( LL_WARNING , " === ASSERTION FAILED === " ) ;
serverLog ( LL_WARNING , " ==> %s:%d '%s' is not true " , file , line , estr ) ;
2020-07-29 10:05:14 -04:00
if ( server . crashlog_enabled ) {
2010-06-21 18:07:48 -04:00
# ifdef HAVE_BACKTRACE
2020-07-29 10:05:14 -04:00
logStackTrace ( NULL , 1 ) ;
2010-06-21 18:07:48 -04:00
# endif
2020-07-29 10:05:14 -04:00
printCrashReport ( ) ;
}
2020-11-03 07:59:21 -05:00
// remove the signal handler so on abort() we will output the crash report.
removeSignalHandlers ( ) ;
2020-07-29 10:05:14 -04:00
bugReportEnd ( 0 , 0 ) ;
2010-06-21 18:07:48 -04:00
}
2016-06-20 16:08:06 -04:00
void _serverAssertPrintClientInfo ( const client * c ) {
2011-10-04 12:05:26 -04:00
int j ;
2019-09-12 03:56:54 -04:00
char conninfo [ CONN_INFO_LEN ] ;
2011-10-04 11:22:29 -04:00
2011-11-24 09:47:26 -05:00
bugReportStart ( ) ;
2015-07-27 03:41:48 -04:00
serverLog ( LL_WARNING , " === ASSERTION FAILED CLIENT CONTEXT === " ) ;
2019-09-12 03:56:54 -04:00
serverLog ( LL_WARNING , " client->flags = %llu " , ( unsigned long long ) c - > flags ) ;
serverLog ( LL_WARNING , " client->conn = %s " , connGetInfo ( c - > conn , conninfo , sizeof ( conninfo ) ) ) ;
2015-07-27 03:41:48 -04:00
serverLog ( LL_WARNING , " client->argc = %d " , c - > argc ) ;
2011-10-04 12:05:26 -04:00
for ( j = 0 ; j < c - > argc ; j + + ) {
char buf [ 128 ] ;
char * arg ;
2015-07-26 09:28:00 -04:00
if ( c - > argv [ j ] - > type = = OBJ_STRING & & sdsEncodedObject ( c - > argv [ j ] ) ) {
2011-10-04 12:05:26 -04:00
arg = ( char * ) c - > argv [ j ] - > ptr ;
} else {
2015-11-28 03:05:41 -05:00
snprintf ( buf , sizeof ( buf ) , " Object type: %u, encoding: %u " ,
2011-10-04 12:05:26 -04:00
c - > argv [ j ] - > type , c - > argv [ j ] - > encoding ) ;
arg = buf ;
2011-10-04 11:22:29 -04:00
}
2015-07-27 03:41:48 -04:00
serverLog ( LL_WARNING , " client->argv[%d] = \" %s \" (refcount: %d) " ,
2011-10-04 12:05:26 -04:00
j , arg , c - > argv [ j ] - > refcount ) ;
}
}
2016-06-20 16:08:06 -04:00
void serverLogObjectDebugInfo ( const robj * o ) {
2021-07-18 08:27:42 -04:00
serverLog ( LL_WARNING , " Object type: %u " , o - > type ) ;
serverLog ( LL_WARNING , " Object encoding: %u " , o - > encoding ) ;
2015-07-27 03:41:48 -04:00
serverLog ( LL_WARNING , " Object refcount: %d " , o - > refcount ) ;
2020-08-14 09:05:34 -04:00
# if UNSAFE_CRASH_REPORT
/* This code is now disabled. o->ptr may be unreliable to print. in some
* cases a ziplist could have already been freed by realloc , but not yet
* updated to o - > ptr . in other cases the call to ziplistLen may need to
* iterate on all the items in the list ( and possibly crash again ) .
* For some cases it may be ok to crash here again , but these could cause
* invalid memory access which will bother valgrind and also possibly cause
* random memory portion to be " leaked " into the logfile . */
2015-07-26 09:28:00 -04:00
if ( o - > type = = OBJ_STRING & & sdsEncodedObject ( o ) ) {
2015-07-27 03:41:48 -04:00
serverLog ( LL_WARNING , " Object raw string len: %zu " , sdslen ( o - > ptr ) ) ;
2013-06-04 09:53:53 -04:00
if ( sdslen ( o - > ptr ) < 4096 ) {
sds repr = sdscatrepr ( sdsempty ( ) , o - > ptr , sdslen ( o - > ptr ) ) ;
2015-07-27 03:41:48 -04:00
serverLog ( LL_WARNING , " Object raw string content: %s " , repr ) ;
2013-06-04 09:53:53 -04:00
sdsfree ( repr ) ;
}
2015-07-26 09:28:00 -04:00
} else if ( o - > type = = OBJ_LIST ) {
2015-07-27 03:41:48 -04:00
serverLog ( LL_WARNING , " List length: %d " , ( int ) listTypeLength ( o ) ) ;
2015-07-26 09:28:00 -04:00
} else if ( o - > type = = OBJ_SET ) {
2015-07-27 03:41:48 -04:00
serverLog ( LL_WARNING , " Set size: %d " , ( int ) setTypeSize ( o ) ) ;
2015-07-26 09:28:00 -04:00
} else if ( o - > type = = OBJ_HASH ) {
2015-07-27 03:41:48 -04:00
serverLog ( LL_WARNING , " Hash size: %d " , ( int ) hashTypeLength ( o ) ) ;
2015-07-26 09:28:00 -04:00
} else if ( o - > type = = OBJ_ZSET ) {
2015-07-27 03:41:48 -04:00
serverLog ( LL_WARNING , " Sorted set size: %d " , ( int ) zsetLength ( o ) ) ;
2015-07-26 09:28:00 -04:00
if ( o - > encoding = = OBJ_ENCODING_SKIPLIST )
2016-06-20 16:08:06 -04:00
serverLog ( LL_WARNING , " Skiplist level: %d " , ( int ) ( ( const zset * ) o - > ptr ) - > zsl - > level ) ;
2020-03-31 10:37:05 -04:00
} else if ( o - > type = = OBJ_STREAM ) {
serverLog ( LL_WARNING , " Stream size: %d " , ( int ) streamLength ( o ) ) ;
2011-10-04 11:22:29 -04:00
}
2020-08-14 09:05:34 -04:00
# endif
2011-10-04 11:22:29 -04:00
}
2016-06-20 16:08:06 -04:00
void _serverAssertPrintObject ( const robj * o ) {
2012-01-12 10:02:57 -05:00
bugReportStart ( ) ;
2015-07-27 03:41:48 -04:00
serverLog ( LL_WARNING , " === ASSERTION FAILED OBJECT CONTEXT === " ) ;
2015-07-26 09:17:43 -04:00
serverLogObjectDebugInfo ( o ) ;
2012-01-12 10:02:57 -05:00
}
2016-06-20 16:08:06 -04:00
void _serverAssertWithInfo ( const client * c , const robj * o , const char * estr , const char * file , int line ) {
2015-07-26 09:29:53 -04:00
if ( c ) _serverAssertPrintClientInfo ( c ) ;
if ( o ) _serverAssertPrintObject ( o ) ;
_serverAssert ( estr , file , line ) ;
2011-10-04 11:22:29 -04:00
}
2017-01-18 11:05:10 -05:00
void _serverPanic ( const char * file , int line , const char * msg , . . . ) {
va_list ap ;
va_start ( ap , msg ) ;
char fmtmsg [ 256 ] ;
vsnprintf ( fmtmsg , sizeof ( fmtmsg ) , msg , ap ) ;
va_end ( ap ) ;
2011-11-24 09:47:26 -05:00
bugReportStart ( ) ;
2015-07-27 03:41:48 -04:00
serverLog ( LL_WARNING , " ------------------------------------------------ " ) ;
serverLog ( LL_WARNING , " !!! Software Failure. Press left mouse button to continue " ) ;
2017-01-18 11:05:10 -05:00
serverLog ( LL_WARNING , " Guru Meditation: %s #%s:%d " , fmtmsg , file , line ) ;
2020-07-29 10:05:14 -04:00
if ( server . crashlog_enabled ) {
2010-06-21 18:07:48 -04:00
# ifdef HAVE_BACKTRACE
2020-07-29 10:05:14 -04:00
logStackTrace ( NULL , 1 ) ;
2012-02-21 13:05:46 -05:00
# endif
2020-07-29 10:05:14 -04:00
printCrashReport ( ) ;
}
2020-11-03 07:59:21 -05:00
// remove the signal handler so on abort() we will output the crash report.
removeSignalHandlers ( ) ;
2020-07-29 10:05:14 -04:00
bugReportEnd ( 0 , 0 ) ;
2010-06-21 18:07:48 -04:00
}
2012-01-20 06:20:45 -05:00
2012-02-08 16:24:59 -05:00
void bugReportStart ( void ) {
2020-08-24 06:54:33 -04:00
pthread_mutex_lock ( & bug_report_start_mutex ) ;
2020-07-29 10:05:14 -04:00
if ( bug_report_start = = 0 ) {
2015-12-16 03:13:41 -05:00
serverLogRaw ( LL_WARNING | LL_RAW ,
" \n \n === REDIS BUG REPORT START: Cut & paste starting from here === \n " ) ;
2020-07-29 10:05:14 -04:00
bug_report_start = 1 ;
2012-02-08 16:24:59 -05:00
}
2020-08-24 06:54:33 -04:00
pthread_mutex_unlock ( & bug_report_start_mutex ) ;
2012-02-08 16:24:59 -05:00
}
2012-01-20 06:20:45 -05:00
# ifdef HAVE_BACKTRACE
static void * getMcontextEip ( ucontext_t * uc ) {
2012-04-24 05:07:15 -04:00
# if defined(__APPLE__) && !defined(MAC_OS_X_VERSION_10_6)
/* OSX < 10.6 */
# if defined(__x86_64__)
2012-01-20 06:20:45 -05:00
return ( void * ) uc - > uc_mcontext - > __ss . __rip ;
2012-04-24 05:07:15 -04:00
# elif defined(__i386__)
2012-01-20 06:20:45 -05:00
return ( void * ) uc - > uc_mcontext - > __ss . __eip ;
2012-04-24 05:07:15 -04:00
# else
2012-01-20 06:20:45 -05:00
return ( void * ) uc - > uc_mcontext - > __ss . __srr0 ;
2012-04-24 05:07:15 -04:00
# endif
2012-01-20 06:20:45 -05:00
# elif defined(__APPLE__) && defined(MAC_OS_X_VERSION_10_6)
2012-04-24 05:07:15 -04:00
/* OSX >= 10.6 */
# if defined(_STRUCT_X86_THREAD_STATE64) && !defined(__i386__)
2012-01-20 06:20:45 -05:00
return ( void * ) uc - > uc_mcontext - > __ss . __rip ;
2020-07-15 05:44:03 -04:00
# elif defined(__i386__)
2012-01-20 06:20:45 -05:00
return ( void * ) uc - > uc_mcontext - > __ss . __eip ;
2020-07-15 05:44:03 -04:00
# else
/* OSX ARM64 */
return ( void * ) arm_thread_state64_get_pc ( uc - > uc_mcontext - > __ss ) ;
2012-04-24 05:07:15 -04:00
# endif
# elif defined(__linux__)
/* Linux */
2020-11-25 15:15:32 -05:00
# if defined(__i386__) || ((defined(__X86_64__) || defined(__x86_64__)) && defined(__ILP32__))
2012-01-20 06:20:45 -05:00
return ( void * ) uc - > uc_mcontext . gregs [ 14 ] ; /* Linux 32 */
2012-04-24 05:07:15 -04:00
# elif defined(__X86_64__) || defined(__x86_64__)
2012-01-20 06:20:45 -05:00
return ( void * ) uc - > uc_mcontext . gregs [ 16 ] ; /* Linux 64 */
2012-04-24 05:07:15 -04:00
# elif defined(__ia64__) /* Linux IA64 */
2012-01-20 06:20:45 -05:00
return ( void * ) uc - > uc_mcontext . sc_ip ;
2016-07-04 16:28:32 -04:00
# elif defined(__arm__) /* Linux ARM */
return ( void * ) uc - > uc_mcontext . arm_pc ;
2017-07-03 03:18:32 -04:00
# elif defined(__aarch64__) /* Linux AArch64 */
return ( void * ) uc - > uc_mcontext . pc ;
2012-04-24 05:07:15 -04:00
# endif
2018-11-24 10:49:45 -05:00
# elif defined(__FreeBSD__)
/* FreeBSD */
# if defined(__i386__)
return ( void * ) uc - > uc_mcontext . mc_eip ;
# elif defined(__x86_64__)
return ( void * ) uc - > uc_mcontext . mc_rip ;
# endif
2018-11-25 03:10:26 -05:00
# elif defined(__OpenBSD__)
/* OpenBSD */
# if defined(__i386__)
return ( void * ) uc - > sc_eip ;
# elif defined(__x86_64__)
return ( void * ) uc - > sc_rip ;
# endif
2020-09-23 03:00:31 -04:00
# elif defined(__NetBSD__)
# if defined(__i386__)
return ( void * ) uc - > uc_mcontext . __gregs [ _REG_EIP ] ;
# elif defined(__x86_64__)
return ( void * ) uc - > uc_mcontext . __gregs [ _REG_RIP ] ;
# endif
2018-11-24 10:49:45 -05:00
# elif defined(__DragonFly__)
return ( void * ) uc - > uc_mcontext . mc_rip ;
2012-01-20 06:20:45 -05:00
# else
return NULL ;
# endif
}
void logStackContent ( void * * sp ) {
int i ;
for ( i = 15 ; i > = 0 ; i - - ) {
2013-02-27 06:27:15 -05:00
unsigned long addr = ( unsigned long ) sp + i ;
unsigned long val = ( unsigned long ) sp [ i ] ;
2012-01-20 10:40:43 -05:00
if ( sizeof ( long ) = = 4 )
2015-07-27 03:41:48 -04:00
serverLog ( LL_WARNING , " (%08lx) -> %08lx " , addr , val ) ;
2012-01-20 10:40:43 -05:00
else
2015-07-27 03:41:48 -04:00
serverLog ( LL_WARNING , " (%016lx) -> %016lx " , addr , val ) ;
2012-01-20 06:20:45 -05:00
}
}
2020-07-29 10:05:14 -04:00
/* Log dump of processor registers */
2012-01-20 06:20:45 -05:00
void logRegisters ( ucontext_t * uc ) {
2015-12-16 03:13:41 -05:00
serverLog ( LL_WARNING | LL_RAW , " \n ------ REGISTERS ------ \n " ) ;
2012-04-24 05:07:15 -04:00
/* OSX */
2012-01-20 06:20:45 -05:00
# if defined(__APPLE__) && defined(MAC_OS_X_VERSION_10_6)
2012-04-24 05:07:15 -04:00
/* OSX AMD64 */
# if defined(_STRUCT_X86_THREAD_STATE64) && !defined(__i386__)
2015-07-27 03:41:48 -04:00
serverLog ( LL_WARNING ,
2012-01-20 06:20:45 -05:00
" \n "
2012-01-20 10:40:43 -05:00
" RAX:%016lx RBX:%016lx \n RCX:%016lx RDX:%016lx \n "
" RDI:%016lx RSI:%016lx \n RBP:%016lx RSP:%016lx \n "
" R8 :%016lx R9 :%016lx \n R10:%016lx R11:%016lx \n "
" R12:%016lx R13:%016lx \n R14:%016lx R15:%016lx \n "
" RIP:%016lx EFL:%016lx \n CS :%016lx FS:%016lx GS:%016lx " ,
2013-02-27 06:27:15 -05:00
( unsigned long ) uc - > uc_mcontext - > __ss . __rax ,
( unsigned long ) uc - > uc_mcontext - > __ss . __rbx ,
( unsigned long ) uc - > uc_mcontext - > __ss . __rcx ,
( unsigned long ) uc - > uc_mcontext - > __ss . __rdx ,
( unsigned long ) uc - > uc_mcontext - > __ss . __rdi ,
( unsigned long ) uc - > uc_mcontext - > __ss . __rsi ,
( unsigned long ) uc - > uc_mcontext - > __ss . __rbp ,
( unsigned long ) uc - > uc_mcontext - > __ss . __rsp ,
( unsigned long ) uc - > uc_mcontext - > __ss . __r8 ,
( unsigned long ) uc - > uc_mcontext - > __ss . __r9 ,
( unsigned long ) uc - > uc_mcontext - > __ss . __r10 ,
( unsigned long ) uc - > uc_mcontext - > __ss . __r11 ,
( unsigned long ) uc - > uc_mcontext - > __ss . __r12 ,
( unsigned long ) uc - > uc_mcontext - > __ss . __r13 ,
( unsigned long ) uc - > uc_mcontext - > __ss . __r14 ,
( unsigned long ) uc - > uc_mcontext - > __ss . __r15 ,
( unsigned long ) uc - > uc_mcontext - > __ss . __rip ,
( unsigned long ) uc - > uc_mcontext - > __ss . __rflags ,
( unsigned long ) uc - > uc_mcontext - > __ss . __cs ,
( unsigned long ) uc - > uc_mcontext - > __ss . __fs ,
( unsigned long ) uc - > uc_mcontext - > __ss . __gs
2012-01-20 06:20:45 -05:00
) ;
logStackContent ( ( void * * ) uc - > uc_mcontext - > __ss . __rsp ) ;
2020-07-15 05:44:03 -04:00
# elif defined(__i386__)
2012-04-24 05:07:15 -04:00
/* OSX x86 */
2015-07-27 03:41:48 -04:00
serverLog ( LL_WARNING ,
2012-01-20 06:20:45 -05:00
" \n "
2012-01-20 10:40:43 -05:00
" EAX:%08lx EBX:%08lx ECX:%08lx EDX:%08lx \n "
" EDI:%08lx ESI:%08lx EBP:%08lx ESP:%08lx \n "
" SS:%08lx EFL:%08lx EIP:%08lx CS :%08lx \n "
" DS:%08lx ES:%08lx FS :%08lx GS :%08lx " ,
2013-02-27 06:27:15 -05:00
( unsigned long ) uc - > uc_mcontext - > __ss . __eax ,
( unsigned long ) uc - > uc_mcontext - > __ss . __ebx ,
( unsigned long ) uc - > uc_mcontext - > __ss . __ecx ,
( unsigned long ) uc - > uc_mcontext - > __ss . __edx ,
( unsigned long ) uc - > uc_mcontext - > __ss . __edi ,
( unsigned long ) uc - > uc_mcontext - > __ss . __esi ,
( unsigned long ) uc - > uc_mcontext - > __ss . __ebp ,
( unsigned long ) uc - > uc_mcontext - > __ss . __esp ,
( unsigned long ) uc - > uc_mcontext - > __ss . __ss ,
( unsigned long ) uc - > uc_mcontext - > __ss . __eflags ,
( unsigned long ) uc - > uc_mcontext - > __ss . __eip ,
( unsigned long ) uc - > uc_mcontext - > __ss . __cs ,
( unsigned long ) uc - > uc_mcontext - > __ss . __ds ,
( unsigned long ) uc - > uc_mcontext - > __ss . __es ,
( unsigned long ) uc - > uc_mcontext - > __ss . __fs ,
( unsigned long ) uc - > uc_mcontext - > __ss . __gs
2012-01-20 06:20:45 -05:00
) ;
logStackContent ( ( void * * ) uc - > uc_mcontext - > __ss . __esp ) ;
2020-07-15 05:44:03 -04:00
# else
/* OSX ARM64 */
serverLog ( LL_WARNING ,
" \n "
" x0:%016lx x1:%016lx x2:%016lx x3:%016lx \n "
" x4:%016lx x5:%016lx x6:%016lx x7:%016lx \n "
" x8:%016lx x9:%016lx x10:%016lx x11:%016lx \n "
" x12:%016lx x13:%016lx x14:%016lx x15:%016lx \n "
" x16:%016lx x17:%016lx x18:%016lx x19:%016lx \n "
" x20:%016lx x21:%016lx x22:%016lx x23:%016lx \n "
" x24:%016lx x25:%016lx x26:%016lx x27:%016lx \n "
" x28:%016lx fp:%016lx lr:%016lx \n "
" sp:%016lx pc:%016lx cpsr:%08lx \n " ,
( unsigned long ) uc - > uc_mcontext - > __ss . __x [ 0 ] ,
( unsigned long ) uc - > uc_mcontext - > __ss . __x [ 1 ] ,
( unsigned long ) uc - > uc_mcontext - > __ss . __x [ 2 ] ,
( unsigned long ) uc - > uc_mcontext - > __ss . __x [ 3 ] ,
( unsigned long ) uc - > uc_mcontext - > __ss . __x [ 4 ] ,
( unsigned long ) uc - > uc_mcontext - > __ss . __x [ 5 ] ,
( unsigned long ) uc - > uc_mcontext - > __ss . __x [ 6 ] ,
( unsigned long ) uc - > uc_mcontext - > __ss . __x [ 7 ] ,
( unsigned long ) uc - > uc_mcontext - > __ss . __x [ 8 ] ,
( unsigned long ) uc - > uc_mcontext - > __ss . __x [ 9 ] ,
( unsigned long ) uc - > uc_mcontext - > __ss . __x [ 10 ] ,
( unsigned long ) uc - > uc_mcontext - > __ss . __x [ 11 ] ,
( unsigned long ) uc - > uc_mcontext - > __ss . __x [ 12 ] ,
( unsigned long ) uc - > uc_mcontext - > __ss . __x [ 13 ] ,
( unsigned long ) uc - > uc_mcontext - > __ss . __x [ 14 ] ,
( unsigned long ) uc - > uc_mcontext - > __ss . __x [ 15 ] ,
( unsigned long ) uc - > uc_mcontext - > __ss . __x [ 16 ] ,
( unsigned long ) uc - > uc_mcontext - > __ss . __x [ 17 ] ,
( unsigned long ) uc - > uc_mcontext - > __ss . __x [ 18 ] ,
( unsigned long ) uc - > uc_mcontext - > __ss . __x [ 19 ] ,
( unsigned long ) uc - > uc_mcontext - > __ss . __x [ 20 ] ,
( unsigned long ) uc - > uc_mcontext - > __ss . __x [ 21 ] ,
( unsigned long ) uc - > uc_mcontext - > __ss . __x [ 22 ] ,
( unsigned long ) uc - > uc_mcontext - > __ss . __x [ 23 ] ,
( unsigned long ) uc - > uc_mcontext - > __ss . __x [ 24 ] ,
( unsigned long ) uc - > uc_mcontext - > __ss . __x [ 25 ] ,
( unsigned long ) uc - > uc_mcontext - > __ss . __x [ 26 ] ,
( unsigned long ) uc - > uc_mcontext - > __ss . __x [ 27 ] ,
( unsigned long ) uc - > uc_mcontext - > __ss . __x [ 28 ] ,
( unsigned long ) arm_thread_state64_get_fp ( uc - > uc_mcontext - > __ss ) ,
( unsigned long ) arm_thread_state64_get_lr ( uc - > uc_mcontext - > __ss ) ,
( unsigned long ) arm_thread_state64_get_sp ( uc - > uc_mcontext - > __ss ) ,
( unsigned long ) arm_thread_state64_get_pc ( uc - > uc_mcontext - > __ss ) ,
( unsigned long ) uc - > uc_mcontext - > __ss . __cpsr
) ;
logStackContent ( ( void * * ) arm_thread_state64_get_sp ( uc - > uc_mcontext - > __ss ) ) ;
2012-04-24 05:07:15 -04:00
# endif
/* Linux */
# elif defined(__linux__)
/* Linux x86 */
2020-11-25 15:15:32 -05:00
# if defined(__i386__) || ((defined(__X86_64__) || defined(__x86_64__)) && defined(__ILP32__))
2015-07-27 03:41:48 -04:00
serverLog ( LL_WARNING ,
2012-01-20 08:37:50 -05:00
" \n "
2012-01-20 10:40:43 -05:00
" EAX:%08lx EBX:%08lx ECX:%08lx EDX:%08lx \n "
" EDI:%08lx ESI:%08lx EBP:%08lx ESP:%08lx \n "
" SS :%08lx EFL:%08lx EIP:%08lx CS:%08lx \n "
" DS :%08lx ES :%08lx FS :%08lx GS:%08lx " ,
2013-02-27 06:27:15 -05:00
( unsigned long ) uc - > uc_mcontext . gregs [ 11 ] ,
( unsigned long ) uc - > uc_mcontext . gregs [ 8 ] ,
( unsigned long ) uc - > uc_mcontext . gregs [ 10 ] ,
( unsigned long ) uc - > uc_mcontext . gregs [ 9 ] ,
( unsigned long ) uc - > uc_mcontext . gregs [ 4 ] ,
( unsigned long ) uc - > uc_mcontext . gregs [ 5 ] ,
( unsigned long ) uc - > uc_mcontext . gregs [ 6 ] ,
( unsigned long ) uc - > uc_mcontext . gregs [ 7 ] ,
( unsigned long ) uc - > uc_mcontext . gregs [ 18 ] ,
( unsigned long ) uc - > uc_mcontext . gregs [ 17 ] ,
( unsigned long ) uc - > uc_mcontext . gregs [ 14 ] ,
( unsigned long ) uc - > uc_mcontext . gregs [ 15 ] ,
( unsigned long ) uc - > uc_mcontext . gregs [ 3 ] ,
( unsigned long ) uc - > uc_mcontext . gregs [ 2 ] ,
( unsigned long ) uc - > uc_mcontext . gregs [ 1 ] ,
( unsigned long ) uc - > uc_mcontext . gregs [ 0 ]
2012-01-20 08:37:50 -05:00
) ;
logStackContent ( ( void * * ) uc - > uc_mcontext . gregs [ 7 ] ) ;
2012-04-24 05:07:15 -04:00
# elif defined(__X86_64__) || defined(__x86_64__)
/* Linux AMD64 */
2015-07-27 03:41:48 -04:00
serverLog ( LL_WARNING ,
2012-01-20 06:54:15 -05:00
" \n "
2012-01-20 10:40:43 -05:00
" RAX:%016lx RBX:%016lx \n RCX:%016lx RDX:%016lx \n "
" RDI:%016lx RSI:%016lx \n RBP:%016lx RSP:%016lx \n "
" R8 :%016lx R9 :%016lx \n R10:%016lx R11:%016lx \n "
" R12:%016lx R13:%016lx \n R14:%016lx R15:%016lx \n "
" RIP:%016lx EFL:%016lx \n CSGSFS:%016lx " ,
2013-02-27 06:27:15 -05:00
( unsigned long ) uc - > uc_mcontext . gregs [ 13 ] ,
( unsigned long ) uc - > uc_mcontext . gregs [ 11 ] ,
( unsigned long ) uc - > uc_mcontext . gregs [ 14 ] ,
( unsigned long ) uc - > uc_mcontext . gregs [ 12 ] ,
( unsigned long ) uc - > uc_mcontext . gregs [ 8 ] ,
( unsigned long ) uc - > uc_mcontext . gregs [ 9 ] ,
( unsigned long ) uc - > uc_mcontext . gregs [ 10 ] ,
( unsigned long ) uc - > uc_mcontext . gregs [ 15 ] ,
( unsigned long ) uc - > uc_mcontext . gregs [ 0 ] ,
( unsigned long ) uc - > uc_mcontext . gregs [ 1 ] ,
( unsigned long ) uc - > uc_mcontext . gregs [ 2 ] ,
( unsigned long ) uc - > uc_mcontext . gregs [ 3 ] ,
( unsigned long ) uc - > uc_mcontext . gregs [ 4 ] ,
( unsigned long ) uc - > uc_mcontext . gregs [ 5 ] ,
( unsigned long ) uc - > uc_mcontext . gregs [ 6 ] ,
( unsigned long ) uc - > uc_mcontext . gregs [ 7 ] ,
( unsigned long ) uc - > uc_mcontext . gregs [ 16 ] ,
( unsigned long ) uc - > uc_mcontext . gregs [ 17 ] ,
( unsigned long ) uc - > uc_mcontext . gregs [ 18 ]
2012-01-20 06:54:15 -05:00
) ;
logStackContent ( ( void * * ) uc - > uc_mcontext . gregs [ 15 ] ) ;
2020-03-07 05:43:41 -05:00
# elif defined(__aarch64__) /* Linux AArch64 */
serverLog ( LL_WARNING ,
" \n "
" X18:%016lx X19:%016lx \n X20:%016lx X21:%016lx \n "
" X22:%016lx X23:%016lx \n X24:%016lx X25:%016lx \n "
" X26:%016lx X27:%016lx \n X28:%016lx X29:%016lx \n "
" X30:%016lx \n "
" pc:%016lx sp:%016lx \n pstate:%016lx fault_address:%016lx \n " ,
( unsigned long ) uc - > uc_mcontext . regs [ 18 ] ,
( unsigned long ) uc - > uc_mcontext . regs [ 19 ] ,
( unsigned long ) uc - > uc_mcontext . regs [ 20 ] ,
( unsigned long ) uc - > uc_mcontext . regs [ 21 ] ,
( unsigned long ) uc - > uc_mcontext . regs [ 22 ] ,
( unsigned long ) uc - > uc_mcontext . regs [ 23 ] ,
( unsigned long ) uc - > uc_mcontext . regs [ 24 ] ,
( unsigned long ) uc - > uc_mcontext . regs [ 25 ] ,
( unsigned long ) uc - > uc_mcontext . regs [ 26 ] ,
( unsigned long ) uc - > uc_mcontext . regs [ 27 ] ,
( unsigned long ) uc - > uc_mcontext . regs [ 28 ] ,
( unsigned long ) uc - > uc_mcontext . regs [ 29 ] ,
( unsigned long ) uc - > uc_mcontext . regs [ 30 ] ,
( unsigned long ) uc - > uc_mcontext . pc ,
( unsigned long ) uc - > uc_mcontext . sp ,
( unsigned long ) uc - > uc_mcontext . pstate ,
( unsigned long ) uc - > uc_mcontext . fault_address
) ;
logStackContent ( ( void * * ) uc - > uc_mcontext . sp ) ;
# elif defined(__arm__) /* Linux ARM */
serverLog ( LL_WARNING ,
" \n "
" R10:%016lx R9 :%016lx \n R8 :%016lx R7 :%016lx \n "
" R6 :%016lx R5 :%016lx \n R4 :%016lx R3 :%016lx \n "
" R2 :%016lx R1 :%016lx \n R0 :%016lx EC :%016lx \n "
2020-11-05 08:43:53 -05:00
" fp: %016lx ip:%016lx \n "
2020-03-07 05:43:41 -05:00
" pc:%016lx sp:%016lx \n cpsr:%016lx fault_address:%016lx \n " ,
( unsigned long ) uc - > uc_mcontext . arm_r10 ,
( unsigned long ) uc - > uc_mcontext . arm_r9 ,
( unsigned long ) uc - > uc_mcontext . arm_r8 ,
( unsigned long ) uc - > uc_mcontext . arm_r7 ,
( unsigned long ) uc - > uc_mcontext . arm_r6 ,
( unsigned long ) uc - > uc_mcontext . arm_r5 ,
( unsigned long ) uc - > uc_mcontext . arm_r4 ,
( unsigned long ) uc - > uc_mcontext . arm_r3 ,
( unsigned long ) uc - > uc_mcontext . arm_r2 ,
( unsigned long ) uc - > uc_mcontext . arm_r1 ,
( unsigned long ) uc - > uc_mcontext . arm_r0 ,
( unsigned long ) uc - > uc_mcontext . error_code ,
( unsigned long ) uc - > uc_mcontext . arm_fp ,
( unsigned long ) uc - > uc_mcontext . arm_ip ,
( unsigned long ) uc - > uc_mcontext . arm_pc ,
( unsigned long ) uc - > uc_mcontext . arm_sp ,
( unsigned long ) uc - > uc_mcontext . arm_cpsr ,
( unsigned long ) uc - > uc_mcontext . fault_address
) ;
logStackContent ( ( void * * ) uc - > uc_mcontext . arm_sp ) ;
2012-04-24 05:07:15 -04:00
# endif
2018-11-24 10:49:45 -05:00
# elif defined(__FreeBSD__)
# if defined(__x86_64__)
serverLog ( LL_WARNING ,
" \n "
" RAX:%016lx RBX:%016lx \n RCX:%016lx RDX:%016lx \n "
" RDI:%016lx RSI:%016lx \n RBP:%016lx RSP:%016lx \n "
" R8 :%016lx R9 :%016lx \n R10:%016lx R11:%016lx \n "
" R12:%016lx R13:%016lx \n R14:%016lx R15:%016lx \n "
" RIP:%016lx EFL:%016lx \n CSGSFS:%016lx " ,
( unsigned long ) uc - > uc_mcontext . mc_rax ,
( unsigned long ) uc - > uc_mcontext . mc_rbx ,
( unsigned long ) uc - > uc_mcontext . mc_rcx ,
( unsigned long ) uc - > uc_mcontext . mc_rdx ,
( unsigned long ) uc - > uc_mcontext . mc_rdi ,
( unsigned long ) uc - > uc_mcontext . mc_rsi ,
( unsigned long ) uc - > uc_mcontext . mc_rbp ,
( unsigned long ) uc - > uc_mcontext . mc_rsp ,
( unsigned long ) uc - > uc_mcontext . mc_r8 ,
( unsigned long ) uc - > uc_mcontext . mc_r9 ,
( unsigned long ) uc - > uc_mcontext . mc_r10 ,
( unsigned long ) uc - > uc_mcontext . mc_r11 ,
( unsigned long ) uc - > uc_mcontext . mc_r12 ,
( unsigned long ) uc - > uc_mcontext . mc_r13 ,
( unsigned long ) uc - > uc_mcontext . mc_r14 ,
( unsigned long ) uc - > uc_mcontext . mc_r15 ,
( unsigned long ) uc - > uc_mcontext . mc_rip ,
( unsigned long ) uc - > uc_mcontext . mc_rflags ,
( unsigned long ) uc - > uc_mcontext . mc_cs
) ;
logStackContent ( ( void * * ) uc - > uc_mcontext . mc_rsp ) ;
# elif defined(__i386__)
serverLog ( LL_WARNING ,
" \n "
" EAX:%08lx EBX:%08lx ECX:%08lx EDX:%08lx \n "
" EDI:%08lx ESI:%08lx EBP:%08lx ESP:%08lx \n "
" SS :%08lx EFL:%08lx EIP:%08lx CS:%08lx \n "
" DS :%08lx ES :%08lx FS :%08lx GS:%08lx " ,
( unsigned long ) uc - > uc_mcontext . mc_eax ,
( unsigned long ) uc - > uc_mcontext . mc_ebx ,
( unsigned long ) uc - > uc_mcontext . mc_ebx ,
( unsigned long ) uc - > uc_mcontext . mc_edx ,
( unsigned long ) uc - > uc_mcontext . mc_edi ,
( unsigned long ) uc - > uc_mcontext . mc_esi ,
( unsigned long ) uc - > uc_mcontext . mc_ebp ,
( unsigned long ) uc - > uc_mcontext . mc_esp ,
( unsigned long ) uc - > uc_mcontext . mc_ss ,
( unsigned long ) uc - > uc_mcontext . mc_eflags ,
( unsigned long ) uc - > uc_mcontext . mc_eip ,
( unsigned long ) uc - > uc_mcontext . mc_cs ,
( unsigned long ) uc - > uc_mcontext . mc_es ,
( unsigned long ) uc - > uc_mcontext . mc_fs ,
( unsigned long ) uc - > uc_mcontext . mc_gs
) ;
logStackContent ( ( void * * ) uc - > uc_mcontext . mc_esp ) ;
# endif
2018-11-25 03:10:26 -05:00
# elif defined(__OpenBSD__)
# if defined(__x86_64__)
serverLog ( LL_WARNING ,
" \n "
" RAX:%016lx RBX:%016lx \n RCX:%016lx RDX:%016lx \n "
" RDI:%016lx RSI:%016lx \n RBP:%016lx RSP:%016lx \n "
" R8 :%016lx R9 :%016lx \n R10:%016lx R11:%016lx \n "
" R12:%016lx R13:%016lx \n R14:%016lx R15:%016lx \n "
" RIP:%016lx EFL:%016lx \n CSGSFS:%016lx " ,
( unsigned long ) uc - > sc_rax ,
( unsigned long ) uc - > sc_rbx ,
( unsigned long ) uc - > sc_rcx ,
( unsigned long ) uc - > sc_rdx ,
( unsigned long ) uc - > sc_rdi ,
( unsigned long ) uc - > sc_rsi ,
( unsigned long ) uc - > sc_rbp ,
( unsigned long ) uc - > sc_rsp ,
( unsigned long ) uc - > sc_r8 ,
( unsigned long ) uc - > sc_r9 ,
( unsigned long ) uc - > sc_r10 ,
( unsigned long ) uc - > sc_r11 ,
( unsigned long ) uc - > sc_r12 ,
( unsigned long ) uc - > sc_r13 ,
( unsigned long ) uc - > sc_r14 ,
( unsigned long ) uc - > sc_r15 ,
( unsigned long ) uc - > sc_rip ,
( unsigned long ) uc - > sc_rflags ,
( unsigned long ) uc - > sc_cs
) ;
logStackContent ( ( void * * ) uc - > sc_rsp ) ;
# elif defined(__i386__)
serverLog ( LL_WARNING ,
" \n "
" EAX:%08lx EBX:%08lx ECX:%08lx EDX:%08lx \n "
" EDI:%08lx ESI:%08lx EBP:%08lx ESP:%08lx \n "
" SS :%08lx EFL:%08lx EIP:%08lx CS:%08lx \n "
" DS :%08lx ES :%08lx FS :%08lx GS:%08lx " ,
( unsigned long ) uc - > sc_eax ,
( unsigned long ) uc - > sc_ebx ,
( unsigned long ) uc - > sc_ebx ,
( unsigned long ) uc - > sc_edx ,
( unsigned long ) uc - > sc_edi ,
( unsigned long ) uc - > sc_esi ,
( unsigned long ) uc - > sc_ebp ,
( unsigned long ) uc - > sc_esp ,
( unsigned long ) uc - > sc_ss ,
( unsigned long ) uc - > sc_eflags ,
( unsigned long ) uc - > sc_eip ,
( unsigned long ) uc - > sc_cs ,
( unsigned long ) uc - > sc_es ,
( unsigned long ) uc - > sc_fs ,
( unsigned long ) uc - > sc_gs
) ;
logStackContent ( ( void * * ) uc - > sc_esp ) ;
# endif
2020-09-23 03:00:31 -04:00
# elif defined(__NetBSD__)
# if defined(__x86_64__)
serverLog ( LL_WARNING ,
" \n "
" RAX:%016lx RBX:%016lx \n RCX:%016lx RDX:%016lx \n "
" RDI:%016lx RSI:%016lx \n RBP:%016lx RSP:%016lx \n "
" R8 :%016lx R9 :%016lx \n R10:%016lx R11:%016lx \n "
" R12:%016lx R13:%016lx \n R14:%016lx R15:%016lx \n "
" RIP:%016lx EFL:%016lx \n CSGSFS:%016lx " ,
( unsigned long ) uc - > uc_mcontext . __gregs [ _REG_RAX ] ,
( unsigned long ) uc - > uc_mcontext . __gregs [ _REG_RBX ] ,
( unsigned long ) uc - > uc_mcontext . __gregs [ _REG_RCX ] ,
( unsigned long ) uc - > uc_mcontext . __gregs [ _REG_RDX ] ,
( unsigned long ) uc - > uc_mcontext . __gregs [ _REG_RDI ] ,
( unsigned long ) uc - > uc_mcontext . __gregs [ _REG_RSI ] ,
( unsigned long ) uc - > uc_mcontext . __gregs [ _REG_RBP ] ,
( unsigned long ) uc - > uc_mcontext . __gregs [ _REG_RSP ] ,
( unsigned long ) uc - > uc_mcontext . __gregs [ _REG_R8 ] ,
( unsigned long ) uc - > uc_mcontext . __gregs [ _REG_R9 ] ,
( unsigned long ) uc - > uc_mcontext . __gregs [ _REG_R10 ] ,
( unsigned long ) uc - > uc_mcontext . __gregs [ _REG_R11 ] ,
( unsigned long ) uc - > uc_mcontext . __gregs [ _REG_R12 ] ,
( unsigned long ) uc - > uc_mcontext . __gregs [ _REG_R13 ] ,
( unsigned long ) uc - > uc_mcontext . __gregs [ _REG_R14 ] ,
( unsigned long ) uc - > uc_mcontext . __gregs [ _REG_R15 ] ,
( unsigned long ) uc - > uc_mcontext . __gregs [ _REG_RIP ] ,
( unsigned long ) uc - > uc_mcontext . __gregs [ _REG_RFLAGS ] ,
( unsigned long ) uc - > uc_mcontext . __gregs [ _REG_CS ]
) ;
logStackContent ( ( void * * ) uc - > uc_mcontext . __gregs [ _REG_RSP ] ) ;
# elif defined(__i386__)
serverLog ( LL_WARNING ,
" \n "
" EAX:%08lx EBX:%08lx ECX:%08lx EDX:%08lx \n "
" EDI:%08lx ESI:%08lx EBP:%08lx ESP:%08lx \n "
" SS :%08lx EFL:%08lx EIP:%08lx CS:%08lx \n "
" DS :%08lx ES :%08lx FS :%08lx GS:%08lx " ,
( unsigned long ) uc - > uc_mcontext . __gregs [ _REG_EAX ] ,
( unsigned long ) uc - > uc_mcontext . __gregs [ _REG_EBX ] ,
( unsigned long ) uc - > uc_mcontext . __gregs [ _REG_EDX ] ,
( unsigned long ) uc - > uc_mcontext . __gregs [ _REG_EDI ] ,
( unsigned long ) uc - > uc_mcontext . __gregs [ _REG_ESI ] ,
( unsigned long ) uc - > uc_mcontext . __gregs [ _REG_EBP ] ,
( unsigned long ) uc - > uc_mcontext . __gregs [ _REG_ESP ] ,
( unsigned long ) uc - > uc_mcontext . __gregs [ _REG_SS ] ,
( unsigned long ) uc - > uc_mcontext . __gregs [ _REG_EFLAGS ] ,
( unsigned long ) uc - > uc_mcontext . __gregs [ _REG_EIP ] ,
( unsigned long ) uc - > uc_mcontext . __gregs [ _REG_CS ] ,
( unsigned long ) uc - > uc_mcontext . __gregs [ _REG_ES ] ,
( unsigned long ) uc - > uc_mcontext . __gregs [ _REG_FS ] ,
( unsigned long ) uc - > uc_mcontext . __gregs [ _REG_GS ]
) ;
# endif
2018-11-24 10:49:45 -05:00
# elif defined(__DragonFly__)
serverLog ( LL_WARNING ,
" \n "
" RAX:%016lx RBX:%016lx \n RCX:%016lx RDX:%016lx \n "
" RDI:%016lx RSI:%016lx \n RBP:%016lx RSP:%016lx \n "
" R8 :%016lx R9 :%016lx \n R10:%016lx R11:%016lx \n "
" R12:%016lx R13:%016lx \n R14:%016lx R15:%016lx \n "
" RIP:%016lx EFL:%016lx \n CSGSFS:%016lx " ,
( unsigned long ) uc - > uc_mcontext . mc_rax ,
( unsigned long ) uc - > uc_mcontext . mc_rbx ,
( unsigned long ) uc - > uc_mcontext . mc_rcx ,
( unsigned long ) uc - > uc_mcontext . mc_rdx ,
( unsigned long ) uc - > uc_mcontext . mc_rdi ,
( unsigned long ) uc - > uc_mcontext . mc_rsi ,
( unsigned long ) uc - > uc_mcontext . mc_rbp ,
( unsigned long ) uc - > uc_mcontext . mc_rsp ,
( unsigned long ) uc - > uc_mcontext . mc_r8 ,
( unsigned long ) uc - > uc_mcontext . mc_r9 ,
( unsigned long ) uc - > uc_mcontext . mc_r10 ,
( unsigned long ) uc - > uc_mcontext . mc_r11 ,
( unsigned long ) uc - > uc_mcontext . mc_r12 ,
( unsigned long ) uc - > uc_mcontext . mc_r13 ,
( unsigned long ) uc - > uc_mcontext . mc_r14 ,
( unsigned long ) uc - > uc_mcontext . mc_r15 ,
( unsigned long ) uc - > uc_mcontext . mc_rip ,
( unsigned long ) uc - > uc_mcontext . mc_rflags ,
( unsigned long ) uc - > uc_mcontext . mc_cs
) ;
logStackContent ( ( void * * ) uc - > uc_mcontext . mc_rsp ) ;
2012-01-20 06:20:45 -05:00
# else
2015-07-27 03:41:48 -04:00
serverLog ( LL_WARNING ,
2012-01-20 06:20:45 -05:00
" Dumping of registers not supported for this OS/arch " ) ;
# endif
}
2020-07-29 10:05:14 -04:00
# endif /* HAVE_BACKTRACE */
2015-12-16 11:41:20 -05:00
/* Return a file descriptor to write directly to the Redis log with the
* write ( 2 ) syscall , that can be used in critical sections of the code
* where the rest of Redis can ' t be trusted ( for example during the memory
* test ) or when an API call requires a raw fd .
*
* Close it with closeDirectLogFiledes ( ) . */
int openDirectLogFiledes ( void ) {
int log_to_stdout = server . logfile [ 0 ] = = ' \0 ' ;
int fd = log_to_stdout ?
STDOUT_FILENO :
open ( server . logfile , O_APPEND | O_CREAT | O_WRONLY , 0644 ) ;
return fd ;
}
/* Used to close what closeDirectLogFiledes() returns. */
void closeDirectLogFiledes ( int fd ) {
int log_to_stdout = server . logfile [ 0 ] = = ' \0 ' ;
if ( ! log_to_stdout ) close ( fd ) ;
}
2020-07-29 10:05:14 -04:00
# ifdef HAVE_BACKTRACE
2012-04-26 10:04:53 -04:00
/* Logs the stack trace using the backtrace() call. This function is designed
2020-07-29 10:05:14 -04:00
* to be called from signal handlers safely .
* The eip argument is optional ( can take NULL ) .
* The uplevel argument indicates how many of the calling functions to skip .
*/
void logStackTrace ( void * eip , int uplevel ) {
void * trace [ 100 ] ;
2015-12-16 11:41:20 -05:00
int trace_size = 0 , fd = openDirectLogFiledes ( ) ;
2020-07-29 10:05:14 -04:00
char * msg ;
uplevel + + ; /* skip this function */
2012-04-26 10:04:53 -04:00
2015-12-16 11:41:20 -05:00
if ( fd = = - 1 ) return ; /* If we can't log there is anything to do. */
2012-01-20 06:20:45 -05:00
2020-07-29 10:05:14 -04:00
/* Get the stack trace first! */
trace_size = backtrace ( trace , 100 ) ;
msg = " \n ------ STACK TRACE ------ \n " ;
if ( write ( fd , msg , strlen ( msg ) ) = = - 1 ) { /* Avoid warning. */ } ;
2015-12-16 03:13:41 -05:00
2020-07-29 10:05:14 -04:00
if ( eip ) {
/* Write EIP to the log file*/
msg = " EIP: \n " ;
if ( write ( fd , msg , strlen ( msg ) ) = = - 1 ) { /* Avoid warning. */ } ;
backtrace_symbols_fd ( & eip , 1 , fd ) ;
2015-12-16 03:13:41 -05:00
}
2012-04-26 10:04:53 -04:00
/* Write symbols to log file */
2020-07-29 10:05:14 -04:00
msg = " \n Backtrace: \n " ;
if ( write ( fd , msg , strlen ( msg ) ) = = - 1 ) { /* Avoid warning. */ } ;
backtrace_symbols_fd ( trace + uplevel , trace_size - uplevel , fd ) ;
2012-04-26 10:04:53 -04:00
/* Cleanup */
2015-12-16 11:41:20 -05:00
closeDirectLogFiledes ( fd ) ;
2012-03-27 04:33:45 -04:00
}
2020-07-29 10:05:14 -04:00
# endif /* HAVE_BACKTRACE */
/* Log global server info */
void logServerInfo ( void ) {
sds infostring , clients ;
serverLogRaw ( LL_WARNING | LL_RAW , " \n ------ INFO OUTPUT ------ \n " ) ;
infostring = genRedisInfoString ( " all " ) ;
serverLogRaw ( LL_WARNING | LL_RAW , infostring ) ;
serverLogRaw ( LL_WARNING | LL_RAW , " \n ------ CLIENT LIST OUTPUT ------ \n " ) ;
clients = getAllClientsInfoString ( - 1 ) ;
serverLogRaw ( LL_WARNING | LL_RAW , clients ) ;
sdsfree ( infostring ) ;
sdsfree ( clients ) ;
}
/* Log modules info. Something we wanna do last since we fear it may crash. */
void logModulesInfo ( void ) {
serverLogRaw ( LL_WARNING | LL_RAW , " \n ------ MODULES INFO OUTPUT ------ \n " ) ;
sds infostring = modulesCollectInfo ( sdsempty ( ) , NULL , 1 , 0 ) ;
serverLogRaw ( LL_WARNING | LL_RAW , infostring ) ;
sdsfree ( infostring ) ;
}
2012-03-27 04:33:45 -04:00
/* Log information about the "current" client, that is, the client that is
* currently being served by Redis . May be NULL if Redis is not serving a
* client right now . */
void logCurrentClient ( void ) {
if ( server . current_client = = NULL ) return ;
2015-07-26 09:20:46 -04:00
client * cc = server . current_client ;
2012-03-27 04:33:45 -04:00
sds client ;
int j ;
2015-12-16 03:13:41 -05:00
serverLogRaw ( LL_WARNING | LL_RAW , " \n ------ CURRENT CLIENT INFO ------ \n " ) ;
2014-04-28 11:36:57 -04:00
client = catClientInfoString ( sdsempty ( ) , cc ) ;
2015-12-16 03:13:41 -05:00
serverLog ( LL_WARNING | LL_RAW , " %s \n " , client ) ;
2012-03-27 04:33:45 -04:00
sdsfree ( client ) ;
for ( j = 0 ; j < cc - > argc ; j + + ) {
robj * decoded ;
decoded = getDecodedObject ( cc - > argv [ j ] ) ;
2015-12-16 03:13:41 -05:00
serverLog ( LL_WARNING | LL_RAW , " argv[%d]: '%s' \n " , j ,
( char * ) decoded - > ptr ) ;
2012-03-27 04:33:45 -04:00
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 . */
2021-01-01 03:23:30 -05:00
if ( cc - > argc > 1 ) {
2012-03-27 04:33:45 -04:00
robj * val , * key ;
dictEntry * de ;
key = getDecodedObject ( cc - > argv [ 1 ] ) ;
de = dictFind ( cc - > db - > dict , key - > ptr ) ;
if ( de ) {
val = dictGetVal ( de ) ;
2015-07-27 03:41:48 -04:00
serverLog ( LL_WARNING , " key '%s' found in DB containing the following object: " , ( char * ) key - > ptr ) ;
2015-07-26 09:17:43 -04:00
serverLogObjectDebugInfo ( val ) ;
2012-03-27 04:33:45 -04:00
}
decrRefCount ( key ) ;
}
}
2012-11-21 07:19:38 -05:00
# if defined(HAVE_PROC_MAPS)
2015-12-16 11:41:20 -05:00
2012-11-25 10:21:21 -05:00
# define MEMTEST_MAX_REGIONS 128
2012-11-21 07:19:38 -05:00
Squash merging 125 typo/grammar/comment/doc PRs (#7773)
List of squashed commits or PRs
===============================
commit 66801ea
Author: hwware <wen.hui.ware@gmail.com>
Date: Mon Jan 13 00:54:31 2020 -0500
typo fix in acl.c
commit 46f55db
Author: Itamar Haber <itamar@redislabs.com>
Date: Sun Sep 6 18:24:11 2020 +0300
Updates a couple of comments
Specifically:
* RM_AutoMemory completed instead of pointing to docs
* Updated link to custom type doc
commit 61a2aa0
Author: xindoo <xindoo@qq.com>
Date: Tue Sep 1 19:24:59 2020 +0800
Correct errors in code comments
commit a5871d1
Author: yz1509 <pro-756@qq.com>
Date: Tue Sep 1 18:36:06 2020 +0800
fix typos in module.c
commit 41eede7
Author: bookug <bookug@qq.com>
Date: Sat Aug 15 01:11:33 2020 +0800
docs: fix typos in comments
commit c303c84
Author: lazy-snail <ws.niu@outlook.com>
Date: Fri Aug 7 11:15:44 2020 +0800
fix spelling in redis.conf
commit 1eb76bf
Author: zhujian <zhujianxyz@gmail.com>
Date: Thu Aug 6 15:22:10 2020 +0800
add a missing 'n' in comment
commit 1530ec2
Author: Daniel Dai <764122422@qq.com>
Date: Mon Jul 27 00:46:35 2020 -0400
fix spelling in tracking.c
commit e517b31
Author: Hunter-Chen <huntcool001@gmail.com>
Date: Fri Jul 17 22:33:32 2020 +0800
Update redis.conf
Co-authored-by: Itamar Haber <itamar@redislabs.com>
commit c300eff
Author: Hunter-Chen <huntcool001@gmail.com>
Date: Fri Jul 17 22:33:23 2020 +0800
Update redis.conf
Co-authored-by: Itamar Haber <itamar@redislabs.com>
commit 4c058a8
Author: 陈浩鹏 <chenhaopeng@heytea.com>
Date: Thu Jun 25 19:00:56 2020 +0800
Grammar fix and clarification
commit 5fcaa81
Author: bodong.ybd <bodong.ybd@alibaba-inc.com>
Date: Fri Jun 19 10:09:00 2020 +0800
Fix typos
commit 4caca9a
Author: Pruthvi P <pruthvi@ixigo.com>
Date: Fri May 22 00:33:22 2020 +0530
Fix typo eviciton => eviction
commit b2a25f6
Author: Brad Dunbar <dunbarb2@gmail.com>
Date: Sun May 17 12:39:59 2020 -0400
Fix a typo.
commit 12842ae
Author: hwware <wen.hui.ware@gmail.com>
Date: Sun May 3 17:16:59 2020 -0400
fix spelling in redis conf
commit ddba07c
Author: Chris Lamb <chris@chris-lamb.co.uk>
Date: Sat May 2 23:25:34 2020 +0100
Correct a "conflicts" spelling error.
commit 8fc7bf2
Author: Nao YONASHIRO <yonashiro@r.recruit.co.jp>
Date: Thu Apr 30 10:25:27 2020 +0900
docs: fix EXPIRE_FAST_CYCLE_DURATION to ACTIVE_EXPIRE_CYCLE_FAST_DURATION
commit 9b2b67a
Author: Brad Dunbar <dunbarb2@gmail.com>
Date: Fri Apr 24 11:46:22 2020 -0400
Fix a typo.
commit 0746f10
Author: devilinrust <63737265+devilinrust@users.noreply.github.com>
Date: Thu Apr 16 00:17:53 2020 +0200
Fix typos in server.c
commit 92b588d
Author: benjessop12 <56115861+benjessop12@users.noreply.github.com>
Date: Mon Apr 13 13:43:55 2020 +0100
Fix spelling mistake in lazyfree.c
commit 1da37aa
Merge: 2d4ba28 af347a8
Author: hwware <wen.hui.ware@gmail.com>
Date: Thu Mar 5 22:41:31 2020 -0500
Merge remote-tracking branch 'upstream/unstable' into expiretypofix
commit 2d4ba28
Author: hwware <wen.hui.ware@gmail.com>
Date: Mon Mar 2 00:09:40 2020 -0500
fix typo in expire.c
commit 1a746f7
Author: SennoYuki <minakami1yuki@gmail.com>
Date: Thu Feb 27 16:54:32 2020 +0800
fix typo
commit 8599b1a
Author: dongheejeong <donghee950403@gmail.com>
Date: Sun Feb 16 20:31:43 2020 +0000
Fix typo in server.c
commit f38d4e8
Author: hwware <wen.hui.ware@gmail.com>
Date: Sun Feb 2 22:58:38 2020 -0500
fix typo in evict.c
commit fe143fc
Author: Leo Murillo <leonardo.murillo@gmail.com>
Date: Sun Feb 2 01:57:22 2020 -0600
Fix a few typos in redis.conf
commit 1ab4d21
Author: viraja1 <anchan.viraj@gmail.com>
Date: Fri Dec 27 17:15:58 2019 +0530
Fix typo in Latency API docstring
commit ca1f70e
Author: gosth <danxuedexing@qq.com>
Date: Wed Dec 18 15:18:02 2019 +0800
fix typo in sort.c
commit a57c06b
Author: ZYunH <zyunhjob@163.com>
Date: Mon Dec 16 22:28:46 2019 +0800
fix-zset-typo
commit b8c92b5
Author: git-hulk <hulk.website@gmail.com>
Date: Mon Dec 16 15:51:42 2019 +0800
FIX: typo in cluster.c, onformation->information
commit 9dd981c
Author: wujm2007 <jim.wujm@gmail.com>
Date: Mon Dec 16 09:37:52 2019 +0800
Fix typo
commit e132d7a
Author: Sebastien Williams-Wynn <s.williamswynn.mail@gmail.com>
Date: Fri Nov 15 00:14:07 2019 +0000
Minor typo change
commit 47f44d5
Author: happynote3966 <01ssrmikururudevice01@gmail.com>
Date: Mon Nov 11 22:08:48 2019 +0900
fix comment typo in redis-cli.c
commit b8bdb0d
Author: fulei <fulei@kuaishou.com>
Date: Wed Oct 16 18:00:17 2019 +0800
Fix a spelling mistake of comments in defragDictBucketCallback
commit 0def46a
Author: fulei <fulei@kuaishou.com>
Date: Wed Oct 16 13:09:27 2019 +0800
fix some spelling mistakes of comments in defrag.c
commit f3596fd
Author: Phil Rajchgot <tophil@outlook.com>
Date: Sun Oct 13 02:02:32 2019 -0400
Typo and grammar fixes
Redis and its documentation are great -- just wanted to submit a few corrections in the spirit of Hacktoberfest. Thanks for all your work on this project. I use it all the time and it works beautifully.
commit 2b928cd
Author: KangZhiDong <worldkzd@gmail.com>
Date: Sun Sep 1 07:03:11 2019 +0800
fix typos
commit 33aea14
Author: Axlgrep <axlgrep@gmail.com>
Date: Tue Aug 27 11:02:18 2019 +0800
Fixed eviction spelling issues
commit e282a80
Author: Simen Flatby <simen@oms.no>
Date: Tue Aug 20 15:25:51 2019 +0200
Update comments to reflect prop name
In the comments the prop is referenced as replica-validity-factor,
but it is really named cluster-replica-validity-factor.
commit 74d1f9a
Author: Jim Green <jimgreen2013@qq.com>
Date: Tue Aug 20 20:00:31 2019 +0800
fix comment error, the code is ok
commit eea1407
Author: Liao Tonglang <liaotonglang@gmail.com>
Date: Fri May 31 10:16:18 2019 +0800
typo fix
fix cna't to can't
commit 0da553c
Author: KAWACHI Takashi <tkawachi@gmail.com>
Date: Wed Jul 17 00:38:16 2019 +0900
Fix typo
commit 7fc8fb6
Author: Michael Prokop <mika@grml.org>
Date: Tue May 28 17:58:42 2019 +0200
Typo fixes
s/familar/familiar/
s/compatiblity/compatibility/
s/ ot / to /
s/itsef/itself/
commit 5f46c9d
Author: zhumoing <34539422+zhumoing@users.noreply.github.com>
Date: Tue May 21 21:16:50 2019 +0800
typo-fixes
typo-fixes
commit 321dfe1
Author: wxisme <850885154@qq.com>
Date: Sat Mar 16 15:10:55 2019 +0800
typo fix
commit b4fb131
Merge: 267e0e6 3df1eb8
Author: Nikitas Bastas <nikitasbst@gmail.com>
Date: Fri Feb 8 22:55:45 2019 +0200
Merge branch 'unstable' of antirez/redis into unstable
commit 267e0e6
Author: Nikitas Bastas <nikitasbst@gmail.com>
Date: Wed Jan 30 21:26:04 2019 +0200
Minor typo fix
commit 30544e7
Author: inshal96 <39904558+inshal96@users.noreply.github.com>
Date: Fri Jan 4 16:54:50 2019 +0500
remove an extra 'a' in the comments
commit 337969d
Author: BrotherGao <yangdongheng11@gmail.com>
Date: Sat Dec 29 12:37:29 2018 +0800
fix typo in redis.conf
commit 9f4b121
Merge: 423a030 e504583
Author: BrotherGao <yangdongheng@xiaomi.com>
Date: Sat Dec 29 11:41:12 2018 +0800
Merge branch 'unstable' of antirez/redis into unstable
commit 423a030
Merge: 42b02b7 46a51cd
Author: 杨东衡 <yangdongheng@xiaomi.com>
Date: Tue Dec 4 23:56:11 2018 +0800
Merge branch 'unstable' of antirez/redis into unstable
commit 42b02b7
Merge: 68c0e6e b8febe6
Author: Dongheng Yang <yangdongheng11@gmail.com>
Date: Sun Oct 28 15:54:23 2018 +0800
Merge pull request #1 from antirez/unstable
update local data
commit 714b589
Author: Christian <crifei93@gmail.com>
Date: Fri Dec 28 01:17:26 2018 +0100
fix typo "resulution"
commit e23259d
Author: garenchan <1412950785@qq.com>
Date: Wed Dec 26 09:58:35 2018 +0800
fix typo: segfauls -> segfault
commit a9359f8
Author: xjp <jianping_xie@aliyun.com>
Date: Tue Dec 18 17:31:44 2018 +0800
Fixed REDISMODULE_H spell bug
commit a12c3e4
Author: jdiaz <jrd.palacios@gmail.com>
Date: Sat Dec 15 23:39:52 2018 -0600
Fixes hyperloglog hash function comment block description
commit 770eb11
Author: 林上耀 <1210tom@163.com>
Date: Sun Nov 25 17:16:10 2018 +0800
fix typo
commit fd97fbb
Author: Chris Lamb <chris@chris-lamb.co.uk>
Date: Fri Nov 23 17:14:01 2018 +0100
Correct "unsupported" typo.
commit a85522d
Author: Jungnam Lee <jungnam.lee@oracle.com>
Date: Thu Nov 8 23:01:29 2018 +0900
fix typo in test comments
commit ade8007
Author: Arun Kumar <palerdot@users.noreply.github.com>
Date: Tue Oct 23 16:56:35 2018 +0530
Fixed grammatical typo
Fixed typo for word 'dictionary'
commit 869ee39
Author: Hamid Alaei <hamid.a85@gmail.com>
Date: Sun Aug 12 16:40:02 2018 +0430
fix documentations: (ThreadSafeContextStart/Stop -> ThreadSafeContextLock/Unlock), minor typo
commit f89d158
Author: Mayank Jain <mayankjain255@gmail.com>
Date: Tue Jul 31 23:01:21 2018 +0530
Updated README.md with some spelling corrections.
Made correction in spelling of some misspelled words.
commit 892198e
Author: dsomeshwar <someshwar.dhayalan@gmail.com>
Date: Sat Jul 21 23:23:04 2018 +0530
typo fix
commit 8a4d780
Author: Itamar Haber <itamar@redislabs.com>
Date: Mon Apr 30 02:06:52 2018 +0300
Fixes some typos
commit e3acef6
Author: Noah Rosamilia <ivoahivoah@gmail.com>
Date: Sat Mar 3 23:41:21 2018 -0500
Fix typo in /deps/README.md
commit 04442fb
Author: WuYunlong <xzsyeb@126.com>
Date: Sat Mar 3 10:32:42 2018 +0800
Fix typo in readSyncBulkPayload() comment.
commit 9f36880
Author: WuYunlong <xzsyeb@126.com>
Date: Sat Mar 3 10:20:37 2018 +0800
replication.c comment: run_id -> replid.
commit f866b4a
Author: Francesco 'makevoid' Canessa <makevoid@gmail.com>
Date: Thu Feb 22 22:01:56 2018 +0000
fix comment typo in server.c
commit 0ebc69b
Author: 줍 <jubee0124@gmail.com>
Date: Mon Feb 12 16:38:48 2018 +0900
Fix typo in redis.conf
Fix `five behaviors` to `eight behaviors` in [this sentence ](antirez/redis@unstable/redis.conf#L564)
commit b50a620
Author: martinbroadhurst <martinbroadhurst@users.noreply.github.com>
Date: Thu Dec 28 12:07:30 2017 +0000
Fix typo in valgrind.sup
commit 7d8f349
Author: Peter Boughton <peter@sorcerersisle.com>
Date: Mon Nov 27 19:52:19 2017 +0000
Update CONTRIBUTING; refer doc updates to redis-doc repo.
commit 02dec7e
Author: Klauswk <klauswk1@hotmail.com>
Date: Tue Oct 24 16:18:38 2017 -0200
Fix typo in comment
commit e1efbc8
Author: chenshi <baiwfg2@gmail.com>
Date: Tue Oct 3 18:26:30 2017 +0800
Correct two spelling errors of comments
commit 93327d8
Author: spacewander <spacewanderlzx@gmail.com>
Date: Wed Sep 13 16:47:24 2017 +0800
Update the comment for OBJ_ENCODING_EMBSTR_SIZE_LIMIT's value
The value of OBJ_ENCODING_EMBSTR_SIZE_LIMIT is 44 now instead of 39.
commit 63d361f
Author: spacewander <spacewanderlzx@gmail.com>
Date: Tue Sep 12 15:06:42 2017 +0800
Fix <prevlen> related doc in ziplist.c
According to the definition of ZIP_BIG_PREVLEN and other related code,
the guard of single byte <prevlen> should be 254 instead of 255.
commit ebe228d
Author: hanael80 <hanael80@gmail.com>
Date: Tue Aug 15 09:09:40 2017 +0900
Fix typo
commit 6b696e6
Author: Matt Robenolt <matt@ydekproductions.com>
Date: Mon Aug 14 14:50:47 2017 -0700
Fix typo in LATENCY DOCTOR output
commit a2ec6ae
Author: caosiyang <caosiyang@qiyi.com>
Date: Tue Aug 15 14:15:16 2017 +0800
Fix a typo: form => from
commit 3ab7699
Author: caosiyang <caosiyang@qiyi.com>
Date: Thu Aug 10 18:40:33 2017 +0800
Fix a typo: replicationFeedSlavesFromMaster() => replicationFeedSlavesFromMasterStream()
commit 72d43ef
Author: caosiyang <caosiyang@qiyi.com>
Date: Tue Aug 8 15:57:25 2017 +0800
fix a typo: servewr => server
commit 707c958
Author: Bo Cai <charpty@gmail.com>
Date: Wed Jul 26 21:49:42 2017 +0800
redis-cli.c typo: conut -> count.
Signed-off-by: Bo Cai <charpty@gmail.com>
commit b9385b2
Author: JackDrogon <jack.xsuperman@gmail.com>
Date: Fri Jun 30 14:22:31 2017 +0800
Fix some spell problems
commit 20d9230
Author: akosel <aaronjkosel@gmail.com>
Date: Sun Jun 4 19:35:13 2017 -0500
Fix typo
commit b167bfc
Author: Krzysiek Witkowicz <krzysiekwitkowicz@gmail.com>
Date: Mon May 22 21:32:27 2017 +0100
Fix #4008 small typo in comment
commit 2b78ac8
Author: Jake Clarkson <jacobwclarkson@gmail.com>
Date: Wed Apr 26 15:49:50 2017 +0100
Correct typo in tests/unit/hyperloglog.tcl
commit b0f1cdb
Author: Qi Luo <qiluo-msft@users.noreply.github.com>
Date: Wed Apr 19 14:25:18 2017 -0700
Fix typo
commit a90b0f9
Author: charsyam <charsyam@naver.com>
Date: Thu Mar 16 18:19:53 2017 +0900
fix typos
fix typos
fix typos
commit 8430a79
Author: Richard Hart <richardhart92@gmail.com>
Date: Mon Mar 13 22:17:41 2017 -0400
Fixed log message typo in listenToPort.
commit 481a1c2
Author: Vinod Kumar <kumar003vinod@gmail.com>
Date: Sun Jan 15 23:04:51 2017 +0530
src/db.c: Correct "save" -> "safe" typo
commit 586b4d3
Author: wangshaonan <wshn13@gmail.com>
Date: Wed Dec 21 20:28:27 2016 +0800
Fix typo they->the in helloworld.c
commit c1c4b5e
Author: Jenner <hypxm@qq.com>
Date: Mon Dec 19 16:39:46 2016 +0800
typo error
commit 1ee1a3f
Author: tielei <43289893@qq.com>
Date: Mon Jul 18 13:52:25 2016 +0800
fix some comments
commit 11a41fb
Author: Otto Kekäläinen <otto@seravo.fi>
Date: Sun Jul 3 10:23:55 2016 +0100
Fix spelling in documentation and comments
commit 5fb5d82
Author: francischan <f1ancis621@gmail.com>
Date: Tue Jun 28 00:19:33 2016 +0800
Fix outdated comments about redis.c file.
It should now refer to server.c file.
commit 6b254bc
Author: lmatt-bit <lmatt123n@gmail.com>
Date: Thu Apr 21 21:45:58 2016 +0800
Refine the comment of dictRehashMilliseconds func
SLAVECONF->REPLCONF in comment - by andyli029
commit ee9869f
Author: clark.kang <charsyam@naver.com>
Date: Tue Mar 22 11:09:51 2016 +0900
fix typos
commit f7b3b11
Author: Harisankar H <harisankarh@gmail.com>
Date: Wed Mar 9 11:49:42 2016 +0530
Typo correction: "faield" --> "failed"
Typo correction: "faield" --> "failed"
commit 3fd40fc
Author: Itamar Haber <itamar@redislabs.com>
Date: Thu Feb 25 10:31:51 2016 +0200
Fixes a typo in comments
commit 621c160
Author: Prayag Verma <prayag.verma@gmail.com>
Date: Mon Feb 1 12:36:20 2016 +0530
Fix typo in Readme.md
Spelling mistakes -
`eviciton` > `eviction`
`familar` > `familiar`
commit d7d07d6
Author: WonCheol Lee <toctoc21c@gmail.com>
Date: Wed Dec 30 15:11:34 2015 +0900
Typo fixed
commit a4dade7
Author: Felix Bünemann <buenemann@louis.info>
Date: Mon Dec 28 11:02:55 2015 +0100
[ci skip] Improve supervised upstart config docs
This mentions that "expect stop" is required for supervised upstart
to work correctly. See http://upstart.ubuntu.com/cookbook/#expect-stop
for an explanation.
commit d9caba9
Author: daurnimator <quae@daurnimator.com>
Date: Mon Dec 21 18:30:03 2015 +1100
README: Remove trailing whitespace
commit 72d42e5
Author: daurnimator <quae@daurnimator.com>
Date: Mon Dec 21 18:29:32 2015 +1100
README: Fix typo. th => the
commit dd6e957
Author: daurnimator <quae@daurnimator.com>
Date: Mon Dec 21 18:29:20 2015 +1100
README: Fix typo. familar => familiar
commit 3a12b23
Author: daurnimator <quae@daurnimator.com>
Date: Mon Dec 21 18:28:54 2015 +1100
README: Fix typo. eviciton => eviction
commit 2d1d03b
Author: daurnimator <quae@daurnimator.com>
Date: Mon Dec 21 18:21:45 2015 +1100
README: Fix typo. sever => server
commit 3973b06
Author: Itamar Haber <itamar@garantiadata.com>
Date: Sat Dec 19 17:01:20 2015 +0200
Typo fix
commit 4f2e460
Author: Steve Gao <fu@2token.com>
Date: Fri Dec 4 10:22:05 2015 +0800
Update README - fix typos
commit b21667c
Author: binyan <binbin.yan@nokia.com>
Date: Wed Dec 2 22:48:37 2015 +0800
delete redundancy color judge in sdscatcolor
commit 88894c7
Author: binyan <binbin.yan@nokia.com>
Date: Wed Dec 2 22:14:42 2015 +0800
the example output shoule be HelloWorld
commit 2763470
Author: binyan <binbin.yan@nokia.com>
Date: Wed Dec 2 17:41:39 2015 +0800
modify error word keyevente
Signed-off-by: binyan <binbin.yan@nokia.com>
commit 0847b3d
Author: Bruno Martins <bscmartins@gmail.com>
Date: Wed Nov 4 11:37:01 2015 +0000
typo
commit bbb9e9e
Author: dawedawe <dawedawe@gmx.de>
Date: Fri Mar 27 00:46:41 2015 +0100
typo: zimap -> zipmap
commit 5ed297e
Author: Axel Advento <badwolf.bloodseeker.rev@gmail.com>
Date: Tue Mar 3 15:58:29 2015 +0800
Fix 'salve' typos to 'slave'
commit edec9d6
Author: LudwikJaniuk <ludvig.janiuk@gmail.com>
Date: Wed Jun 12 14:12:47 2019 +0200
Update README.md
Co-Authored-By: Qix <Qix-@users.noreply.github.com>
commit 692a7af
Author: LudwikJaniuk <ludvig.janiuk@gmail.com>
Date: Tue May 28 14:32:04 2019 +0200
grammar
commit d962b0a
Author: Nick Frost <nickfrostatx@gmail.com>
Date: Wed Jul 20 15:17:12 2016 -0700
Minor grammar fix
commit 24fff01aaccaf5956973ada8c50ceb1462e211c6 (typos)
Author: Chad Miller <chadm@squareup.com>
Date: Tue Sep 8 13:46:11 2020 -0400
Fix faulty comment about operation of unlink()
commit 3cd5c1f3326c52aa552ada7ec797c6bb16452355
Author: Kevin <kevin.xgr@gmail.com>
Date: Wed Nov 20 00:13:50 2019 +0800
Fix typo in server.c.
From a83af59 Mon Sep 17 00:00:00 2001
From: wuwo <wuwo@wacai.com>
Date: Fri, 17 Mar 2017 20:37:45 +0800
Subject: [PATCH] falure to failure
From c961896 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=B7=A6=E6=87=B6?= <veficos@gmail.com>
Date: Sat, 27 May 2017 15:33:04 +0800
Subject: [PATCH] fix typo
From e600ef2 Mon Sep 17 00:00:00 2001
From: "rui.zou" <rui.zou@yunify.com>
Date: Sat, 30 Sep 2017 12:38:15 +0800
Subject: [PATCH] fix a typo
From c7d07fa Mon Sep 17 00:00:00 2001
From: Alexandre Perrin <alex@kaworu.ch>
Date: Thu, 16 Aug 2018 10:35:31 +0200
Subject: [PATCH] deps README.md typo
From b25cb67 Mon Sep 17 00:00:00 2001
From: Guy Korland <gkorland@gmail.com>
Date: Wed, 26 Sep 2018 10:55:37 +0300
Subject: [PATCH 1/2] fix typos in header
From ad28ca6 Mon Sep 17 00:00:00 2001
From: Guy Korland <gkorland@gmail.com>
Date: Wed, 26 Sep 2018 11:02:36 +0300
Subject: [PATCH 2/2] fix typos
commit 34924cdedd8552466fc22c1168d49236cb7ee915
Author: Adrian Lynch <adi_ady_ade@hotmail.com>
Date: Sat Apr 4 21:59:15 2015 +0100
Typos fixed
commit fd2a1e7
Author: Jan <jsteemann@users.noreply.github.com>
Date: Sat Oct 27 19:13:01 2018 +0200
Fix typos
Fix typos
commit e14e47c1a234b53b0e103c5f6a1c61481cbcbb02
Author: Andy Lester <andy@petdance.com>
Date: Fri Aug 2 22:30:07 2019 -0500
Fix multiple misspellings of "following"
commit 79b948ce2dac6b453fe80995abbcaac04c213d5a
Author: Andy Lester <andy@petdance.com>
Date: Fri Aug 2 22:24:28 2019 -0500
Fix misspelling of create-cluster
commit 1fffde52666dc99ab35efbd31071a4c008cb5a71
Author: Andy Lester <andy@petdance.com>
Date: Wed Jul 31 17:57:56 2019 -0500
Fix typos
commit 204c9ba9651e9e05fd73936b452b9a30be456cfe
Author: Xiaobo Zhu <xiaobo.zhu@shopee.com>
Date: Tue Aug 13 22:19:25 2019 +0800
fix typos
Squashed commit of the following:
commit 1d9aaf8
Author: danmedani <danmedani@gmail.com>
Date: Sun Aug 2 11:40:26 2015 -0700
README typo fix.
Squashed commit of the following:
commit 32bfa7c
Author: Erik Dubbelboer <erik@dubbelboer.com>
Date: Mon Jul 6 21:15:08 2015 +0200
Fixed grammer
Squashed commit of the following:
commit b24f69c
Author: Sisir Koppaka <sisir.koppaka@gmail.com>
Date: Mon Mar 2 22:38:45 2015 -0500
utils/hashtable/rehashing.c: Fix typos
Squashed commit of the following:
commit 4e04082
Author: Erik Dubbelboer <erik@dubbelboer.com>
Date: Mon Mar 23 08:22:21 2015 +0000
Small config file documentation improvements
Squashed commit of the following:
commit acb8773
Author: ctd1500 <ctd1500@gmail.com>
Date: Fri May 8 01:52:48 2015 -0700
Typo and grammar fixes in readme
commit 2eb75b6
Author: ctd1500 <ctd1500@gmail.com>
Date: Fri May 8 01:36:18 2015 -0700
fixed redis.conf comment
Squashed commit of the following:
commit a8249a2
Author: Masahiko Sawada <sawada.mshk@gmail.com>
Date: Fri Dec 11 11:39:52 2015 +0530
Revise correction of typos.
Squashed commit of the following:
commit 3c02028
Author: zhaojun11 <zhaojun11@jd.com>
Date: Wed Jan 17 19:05:28 2018 +0800
Fix typos include two code typos in cluster.c and latency.c
Squashed commit of the following:
commit 9dba47c
Author: q191201771 <191201771@qq.com>
Date: Sat Jan 4 11:31:04 2020 +0800
fix function listCreate comment in adlist.c
Update src/server.c
commit 2c7c2cb536e78dd211b1ac6f7bda00f0f54faaeb
Author: charpty <charpty@gmail.com>
Date: Tue May 1 23:16:59 2018 +0800
server.c typo: modules system dictionary type comment
Signed-off-by: charpty <charpty@gmail.com>
commit a8395323fb63cb59cb3591cb0f0c8edb7c29a680
Author: Itamar Haber <itamar@redislabs.com>
Date: Sun May 6 00:25:18 2018 +0300
Updates test_helper.tcl's help with undocumented options
Specifically:
* Host
* Port
* Client
commit bde6f9ced15755cd6407b4af7d601b030f36d60b
Author: wxisme <850885154@qq.com>
Date: Wed Aug 8 15:19:19 2018 +0800
fix comments in deps files
commit 3172474ba991532ab799ee1873439f3402412331
Author: wxisme <850885154@qq.com>
Date: Wed Aug 8 14:33:49 2018 +0800
fix some comments
commit 01b6f2b6858b5cf2ce4ad5092d2c746e755f53f0
Author: Thor Juhasz <thor@juhasz.pro>
Date: Sun Nov 18 14:37:41 2018 +0100
Minor fixes to comments
Found some parts a little unclear on a first read, which prompted me to have a better look at the file and fix some minor things I noticed.
Fixing minor typos and grammar. There are no changes to configuration options.
These changes are only meant to help the user better understand the explanations to the various configuration options
2020-09-10 06:43:38 -04:00
/* A non destructive memory test executed during segfault. */
2012-11-21 07:19:38 -05:00
int memtest_test_linux_anonymous_maps ( void ) {
2015-12-16 11:41:20 -05:00
FILE * fp ;
2012-11-21 07:19:38 -05:00
char line [ 1024 ] ;
2015-12-16 11:41:20 -05:00
char logbuf [ 1024 ] ;
2012-11-21 07:19:38 -05:00
size_t start_addr , end_addr , size ;
2012-11-25 10:21:21 -05:00
size_t start_vect [ MEMTEST_MAX_REGIONS ] ;
size_t size_vect [ MEMTEST_MAX_REGIONS ] ;
int regions = 0 , j ;
2012-11-21 07:19:38 -05:00
2015-12-16 11:41:20 -05:00
int fd = openDirectLogFiledes ( ) ;
if ( ! fd ) return 0 ;
fp = fopen ( " /proc/self/maps " , " r " ) ;
if ( ! fp ) return 0 ;
2012-11-21 07:19:38 -05:00
while ( fgets ( line , sizeof ( line ) , fp ) ! = NULL ) {
char * start , * end , * p = line ;
start = p ;
p = strchr ( p , ' - ' ) ;
if ( ! p ) continue ;
* p + + = ' \0 ' ;
end = p ;
p = strchr ( p , ' ' ) ;
if ( ! p ) continue ;
* p + + = ' \0 ' ;
if ( strstr ( p , " stack " ) | |
strstr ( p , " vdso " ) | |
strstr ( p , " vsyscall " ) ) continue ;
if ( ! strstr ( p , " 00:00 " ) ) continue ;
if ( ! strstr ( p , " rw " ) ) continue ;
start_addr = strtoul ( start , NULL , 16 ) ;
end_addr = strtoul ( end , NULL , 16 ) ;
size = end_addr - start_addr ;
2012-11-25 10:21:21 -05:00
start_vect [ regions ] = start_addr ;
size_vect [ regions ] = size ;
2015-12-16 11:41:20 -05:00
snprintf ( logbuf , sizeof ( logbuf ) ,
" *** Preparing to test memory region %lx (%lu bytes) \n " ,
( unsigned long ) start_vect [ regions ] ,
( unsigned long ) size_vect [ regions ] ) ;
if ( write ( fd , logbuf , strlen ( logbuf ) ) = = - 1 ) { /* Nothing to do. */ }
2012-11-25 10:21:21 -05:00
regions + + ;
2012-11-21 07:19:38 -05:00
}
2012-11-25 10:21:21 -05:00
2015-12-16 11:41:20 -05:00
int errors = 0 ;
2012-11-25 10:21:21 -05:00
for ( j = 0 ; j < regions ; j + + ) {
2015-12-16 11:41:20 -05:00
if ( write ( fd , " . " , 1 ) = = - 1 ) { /* Nothing to do. */ }
errors + = memtest_preserving_test ( ( void * ) start_vect [ j ] , size_vect [ j ] , 1 ) ;
if ( write ( fd , errors ? " E " : " O " , 1 ) = = - 1 ) { /* Nothing to do. */ }
2012-11-25 10:21:21 -05:00
}
2015-12-16 11:41:20 -05:00
if ( write ( fd , " \n " , 1 ) = = - 1 ) { /* Nothing to do. */ }
2012-11-25 10:21:21 -05:00
/* NOTE: It is very important to close the file descriptor only now
* because closing it before may result into unmapping of some memory
* region that we are testing . */
2012-11-21 07:19:38 -05:00
fclose ( fp ) ;
2015-12-16 11:41:20 -05:00
closeDirectLogFiledes ( fd ) ;
return errors ;
2012-11-21 07:19:38 -05:00
}
2020-09-20 05:06:17 -04:00
# endif /* HAVE_PROC_MAPS */
2012-11-21 07:19:38 -05:00
2020-09-15 01:06:47 -04:00
static void killMainThread ( void ) {
int err ;
if ( pthread_self ( ) ! = server . main_thread_id & & pthread_cancel ( server . main_thread_id ) = = 0 ) {
if ( ( err = pthread_join ( server . main_thread_id , NULL ) ) ! = 0 ) {
serverLog ( LL_WARNING , " main thread can not be joined: %s " , strerror ( err ) ) ;
} else {
serverLog ( LL_WARNING , " main thread terminated " ) ;
}
}
}
/* Kill the running threads (other than current) in an unclean way. This function
* should be used only when it ' s critical to stop the threads for some reason .
* Currently Redis does this only on crash ( for instance on SIGSEGV ) in order
* to perform a fast memory check without other threads messing with memory . */
2020-09-20 05:06:17 -04:00
void killThreads ( void ) {
2020-09-15 01:06:47 -04:00
killMainThread ( ) ;
bioKillThreads ( ) ;
2020-09-15 21:58:24 -04:00
killIOThreads ( ) ;
2020-09-15 01:06:47 -04:00
}
2020-07-29 10:05:14 -04:00
void doFastMemoryTest ( void ) {
# if defined(HAVE_PROC_MAPS)
if ( server . memcheck_enabled ) {
/* Test memory */
serverLogRaw ( LL_WARNING | LL_RAW , " \n ------ FAST MEMORY TEST ------ \n " ) ;
2020-09-15 01:06:47 -04:00
killThreads ( ) ;
2020-07-29 10:05:14 -04:00
if ( memtest_test_linux_anonymous_maps ( ) ) {
serverLogRaw ( LL_WARNING | LL_RAW ,
" !!! MEMORY ERROR DETECTED! Check your memory ASAP !!! \n " ) ;
} else {
serverLogRaw ( LL_WARNING | LL_RAW ,
" Fast memory test PASSED, however your memory can still be broken. Please run a memory test for several hours if possible. \n " ) ;
}
}
2020-09-20 05:06:17 -04:00
# endif /* HAVE_PROC_MAPS */
2020-07-29 10:05:14 -04:00
}
2016-09-09 04:59:29 -04:00
/* Scans the (assumed) x86 code starting at addr, for a max of `len`
* bytes , searching for E8 ( callq ) opcodes , and dumping the symbols
* and the call offset if they appear to be valid . */
void dumpX86Calls ( void * addr , size_t len ) {
size_t j ;
unsigned char * p = addr ;
Dl_info info ;
/* Hash table to best-effort avoid printing the same symbol
* multiple times . */
unsigned long ht [ 256 ] = { 0 } ;
if ( len < 5 ) return ;
for ( j = 0 ; j < len - 4 ; j + + ) {
if ( p [ j ] ! = 0xE8 ) continue ; /* Not an E8 CALL opcode. */
unsigned long target = ( unsigned long ) addr + j + 5 ;
target + = * ( ( int32_t * ) ( p + j + 1 ) ) ;
if ( dladdr ( ( void * ) target , & info ) ! = 0 & & info . dli_sname ! = NULL ) {
if ( ht [ target & 0xff ] ! = target ) {
printf ( " Function at 0x%lx is %s \n " , target , info . dli_sname ) ;
ht [ target & 0xff ] = target ;
}
j + = 4 ; /* Skip the 32 bit immediate. */
}
}
}
2020-07-29 10:05:14 -04:00
void dumpCodeAroundEIP ( void * eip ) {
Dl_info info ;
if ( dladdr ( eip , & info ) ! = 0 ) {
serverLog ( LL_WARNING | LL_RAW ,
" \n ------ DUMPING CODE AROUND EIP ------ \n "
" Symbol: %s (base: %p) \n "
" Module: %s (base %p) \n "
" $ xxd -r -p /tmp/dump.hex /tmp/dump.bin \n "
" $ objdump --adjust-vma=%p -D -b binary -m i386:x86-64 /tmp/dump.bin \n "
" ------ \n " ,
info . dli_sname , info . dli_saddr , info . dli_fname , info . dli_fbase ,
info . dli_saddr ) ;
size_t len = ( long ) eip - ( long ) info . dli_saddr ;
unsigned long sz = sysconf ( _SC_PAGESIZE ) ;
if ( len < 1 < < 13 ) { /* we don't have functions over 8k (verified) */
/* Find the address of the next page, which is our "safety"
* limit when dumping . Then try to dump just 128 bytes more
* than EIP if there is room , or stop sooner . */
2020-09-19 05:24:40 -04:00
void * base = ( void * ) info . dli_saddr ;
2020-07-29 10:05:14 -04:00
unsigned long next = ( ( unsigned long ) eip + sz ) & ~ ( sz - 1 ) ;
unsigned long end = ( unsigned long ) eip + 128 ;
if ( end > next ) end = next ;
2020-09-19 05:24:40 -04:00
len = end - ( unsigned long ) base ;
2020-07-29 10:05:14 -04:00
serverLogHexDump ( LL_WARNING , " dump of function " ,
2020-09-19 05:24:40 -04:00
base , len ) ;
dumpX86Calls ( base , len ) ;
2020-07-29 10:05:14 -04:00
}
}
}
2012-03-27 04:33:45 -04:00
void sigsegvHandler ( int sig , siginfo_t * info , void * secret ) {
2020-07-29 10:05:14 -04:00
UNUSED ( secret ) ;
2015-07-27 03:41:48 -04:00
UNUSED ( info ) ;
2012-03-27 04:33:45 -04:00
bugReportStart ( ) ;
2015-07-27 03:41:48 -04:00
serverLog ( LL_WARNING ,
2020-10-07 13:28:57 -04:00
" Redis %s crashed by signal: %d, si_code: %d " , REDIS_VERSION , sig , info - > si_code ) ;
2015-12-16 03:13:41 -05:00
if ( sig = = SIGSEGV | | sig = = SIGBUS ) {
serverLog ( LL_WARNING ,
" Accessing address: %p " , ( void * ) info - > si_addr ) ;
2015-12-15 12:00:29 -05:00
}
2021-03-24 02:33:24 -04:00
if ( info - > si_code < = SI_USER & & info - > si_pid ! = - 1 ) {
2020-12-13 10:09:54 -05:00
serverLog ( LL_WARNING , " Killed by PID: %ld, UID: %d " , ( long ) info - > si_pid , info - > si_uid ) ;
2020-10-07 13:28:57 -04:00
}
2012-03-27 04:33:45 -04:00
2020-07-29 10:05:14 -04:00
# ifdef HAVE_BACKTRACE
ucontext_t * uc = ( ucontext_t * ) secret ;
void * eip = getMcontextEip ( uc ) ;
if ( eip ! = NULL ) {
serverLog ( LL_WARNING ,
" Crashed running the instruction at: %p " , eip ) ;
}
logStackTrace ( getMcontextEip ( uc ) , 1 ) ;
logRegisters ( uc ) ;
# endif
2012-01-20 06:20:45 -05:00
2020-07-29 10:05:14 -04:00
printCrashReport ( ) ;
# ifdef HAVE_BACKTRACE
if ( eip ! = NULL )
dumpCodeAroundEIP ( eip ) ;
# endif
bugReportEnd ( 1 , sig ) ;
}
void printCrashReport ( void ) {
2012-01-20 06:20:45 -05:00
/* Log INFO and CLIENT LIST */
2020-07-29 10:05:14 -04:00
logServerInfo ( ) ;
2012-01-20 06:20:45 -05:00
2012-03-27 04:33:45 -04:00
/* Log the current client */
logCurrentClient ( ) ;
2012-01-20 06:20:45 -05:00
2020-07-29 10:05:14 -04:00
/* Log modules info. Something we wanna do last since we fear it may crash. */
logModulesInfo ( ) ;
2012-01-20 06:20:45 -05:00
2020-07-29 10:05:14 -04:00
/* Run memory test in case the crash was triggered by memory corruption. */
doFastMemoryTest ( ) ;
}
2012-11-21 07:19:38 -05:00
2020-07-29 10:05:14 -04:00
void bugReportEnd ( int killViaSignal , int sig ) {
struct sigaction act ;
2016-09-09 04:59:29 -04:00
2015-12-16 03:13:41 -05:00
serverLogRaw ( LL_WARNING | LL_RAW ,
2012-01-20 06:20:45 -05:00
" \n === REDIS BUG REPORT END. Make sure to include from START to END. === \n \n "
2014-08-28 10:36:32 -04:00
" Please report the crash by opening an issue on github: \n \n "
2020-07-10 01:25:26 -04:00
" http://github.com/redis/redis/issues \n \n "
2014-05-28 03:46:01 -04:00
" Suspect RAM error? Use redis-server --test-memory to verify it. \n \n "
2012-01-20 06:20:45 -05:00
) ;
2016-09-09 04:59:29 -04:00
2012-01-20 06:20:45 -05:00
/* free(messages); Don't call free() with possibly corrupted memory. */
2020-12-22 08:17:39 -05:00
if ( server . daemonize & & server . supervised = = 0 & & server . pidfile ) unlink ( server . pidfile ) ;
2012-01-20 06:20:45 -05:00
2020-07-29 10:05:14 -04:00
if ( ! killViaSignal ) {
if ( server . use_exit_on_panic )
exit ( 1 ) ;
abort ( ) ;
}
2012-01-20 06:20:45 -05:00
/* Make sure we exit with the right signal at the end. So for instance
* the core will be dumped if enabled . */
sigemptyset ( & act . sa_mask ) ;
act . sa_flags = SA_NODEFER | SA_ONSTACK | SA_RESETHAND ;
act . sa_handler = SIG_DFL ;
sigaction ( sig , & act , NULL ) ;
kill ( getpid ( ) , sig ) ;
}
2012-03-27 05:47:51 -04:00
2012-06-11 17:44:34 -04:00
/* ==================== Logging functions for debugging ===================== */
2015-07-26 09:17:43 -04:00
void serverLogHexDump ( int level , char * descr , void * value , size_t len ) {
2012-06-11 17:44:34 -04:00
char buf [ 65 ] , * b ;
unsigned char * v = value ;
char charset [ ] = " 0123456789abcdef " ;
2016-09-09 04:59:29 -04:00
serverLog ( level , " %s (hexdump of %zu bytes): " , descr , len ) ;
2012-06-11 17:44:34 -04:00
b = buf ;
while ( len ) {
b [ 0 ] = charset [ ( * v ) > > 4 ] ;
b [ 1 ] = charset [ ( * v ) & 0xf ] ;
b [ 2 ] = ' \0 ' ;
b + = 2 ;
len - - ;
v + + ;
if ( b - buf = = 64 | | len = = 0 ) {
2015-07-27 03:41:48 -04:00
serverLogRaw ( level | LL_RAW , buf ) ;
2012-06-11 17:44:34 -04:00
b = buf ;
}
}
2015-07-27 03:41:48 -04:00
serverLogRaw ( level | LL_RAW , " \n " ) ;
2012-06-11 17:44:34 -04:00
}
2012-03-27 05:47:51 -04:00
/* =========================== Software Watchdog ============================ */
# include <sys/time.h>
void watchdogSignalHandler ( int sig , siginfo_t * info , void * secret ) {
2012-04-24 05:07:15 -04:00
# ifdef HAVE_BACKTRACE
2012-03-27 05:47:51 -04:00
ucontext_t * uc = ( ucontext_t * ) secret ;
2018-11-08 05:13:52 -05:00
# else
( void ) secret ;
2012-04-24 05:07:15 -04:00
# endif
2015-07-27 03:41:48 -04:00
UNUSED ( info ) ;
UNUSED ( sig ) ;
2012-03-27 05:47:51 -04:00
2015-07-27 03:41:48 -04:00
serverLogFromHandler ( LL_WARNING , " \n --- WATCHDOG TIMER EXPIRED --- " ) ;
2012-03-27 05:47:51 -04:00
# ifdef HAVE_BACKTRACE
2020-07-29 10:05:14 -04:00
logStackTrace ( getMcontextEip ( uc ) , 1 ) ;
2012-03-27 09:24:33 -04:00
# else
2015-07-27 03:41:48 -04:00
serverLogFromHandler ( LL_WARNING , " Sorry: no support for backtrace(). " ) ;
2012-03-27 05:47:51 -04:00
# endif
2015-07-27 03:41:48 -04:00
serverLogFromHandler ( LL_WARNING , " -------- \n " ) ;
2012-03-27 05:47:51 -04:00
}
/* Schedule a SIGALRM delivery after the specified period in milliseconds.
* If a timer is already scheduled , this function will re - schedule it to the
* specified time . If period is 0 the current timer is disabled . */
void watchdogScheduleSignal ( int period ) {
struct itimerval it ;
/* Will stop the timer if period is 0. */
it . it_value . tv_sec = period / 1000 ;
2012-03-27 06:11:37 -04:00
it . it_value . tv_usec = ( period % 1000 ) * 1000 ;
2012-03-27 05:47:51 -04:00
/* Don't automatically restart. */
it . it_interval . tv_sec = 0 ;
it . it_interval . tv_usec = 0 ;
setitimer ( ITIMER_REAL , & it , NULL ) ;
}
2012-11-27 14:41:33 -05:00
/* Enable the software watchdog with the specified period in milliseconds. */
2012-03-27 05:47:51 -04:00
void enableWatchdog ( int period ) {
2012-05-13 15:52:35 -04:00
int min_period ;
2012-03-27 05:47:51 -04:00
if ( server . watchdog_period = = 0 ) {
struct sigaction act ;
/* Watchdog was actually disabled, so we have to setup the signal
* handler . */
sigemptyset ( & act . sa_mask ) ;
2020-05-03 02:31:50 -04:00
act . sa_flags = SA_SIGINFO ;
2012-03-27 05:47:51 -04:00
act . sa_sigaction = watchdogSignalHandler ;
sigaction ( SIGALRM , & act , NULL ) ;
}
2012-05-13 15:52:35 -04:00
/* If the configured period is smaller than twice the timer period, it is
* too short for the software watchdog to work reliably . Fix it now
* if needed . */
2012-12-14 11:10:40 -05:00
min_period = ( 1000 / server . hz ) * 2 ;
2012-05-13 15:52:35 -04:00
if ( period < min_period ) period = min_period ;
2012-03-27 05:47:51 -04:00
watchdogScheduleSignal ( period ) ; /* Adjust the current timer. */
server . watchdog_period = period ;
}
/* Disable the software watchdog. */
void disableWatchdog ( void ) {
struct sigaction act ;
if ( server . watchdog_period = = 0 ) return ; /* Already disabled. */
watchdogScheduleSignal ( 0 ) ; /* Stop the current timer. */
/* Set the signal handler to SIG_IGN, this will also remove pending
* signals from the queue . */
sigemptyset ( & act . sa_mask ) ;
act . sa_flags = 0 ;
act . sa_handler = SIG_IGN ;
sigaction ( SIGALRM , & act , NULL ) ;
server . watchdog_period = 0 ;
}
2020-09-03 01:47:29 -04:00
/* Positive input is sleep time in microseconds. Negative input is fractions
* of microseconds , i . e . - 10 means 100 nanoseconds . */
void debugDelay ( int usec ) {
/* Since even the shortest sleep results in context switch and system call,
2021-06-10 08:39:33 -04:00
* the way we achieve short sleeps is by statistically sleeping less often . */
2020-09-03 01:47:29 -04:00
if ( usec < 0 ) usec = ( rand ( ) % - usec ) = = 0 ? 1 : 0 ;
if ( usec ) usleep ( usec ) ;
}