MCPcopy Create free account
hub / github.com/F-Stack/f-stack / serverLogObjectDebugInfo

Function serverLogObjectDebugInfo

app/redis-6.2.6/src/debug.c:940–973  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

938}
939
940void serverLogObjectDebugInfo(const robj *o) {
941 serverLog(LL_WARNING,"Object type: %d", o->type);
942 serverLog(LL_WARNING,"Object encoding: %d", o->encoding);
943 serverLog(LL_WARNING,"Object refcount: %d", o->refcount);
944#if UNSAFE_CRASH_REPORT
945 /* This code is now disabled. o->ptr may be unreliable to print. in some
946 * cases a ziplist could have already been freed by realloc, but not yet
947 * updated to o->ptr. in other cases the call to ziplistLen may need to
948 * iterate on all the items in the list (and possibly crash again).
949 * For some cases it may be ok to crash here again, but these could cause
950 * invalid memory access which will bother valgrind and also possibly cause
951 * random memory portion to be "leaked" into the logfile. */
952 if (o->type == OBJ_STRING && sdsEncodedObject(o)) {
953 serverLog(LL_WARNING,"Object raw string len: %zu", sdslen(o->ptr));
954 if (sdslen(o->ptr) < 4096) {
955 sds repr = sdscatrepr(sdsempty(),o->ptr,sdslen(o->ptr));
956 serverLog(LL_WARNING,"Object raw string content: %s", repr);
957 sdsfree(repr);
958 }
959 } else if (o->type == OBJ_LIST) {
960 serverLog(LL_WARNING,"List length: %d", (int) listTypeLength(o));
961 } else if (o->type == OBJ_SET) {
962 serverLog(LL_WARNING,"Set size: %d", (int) setTypeSize(o));
963 } else if (o->type == OBJ_HASH) {
964 serverLog(LL_WARNING,"Hash size: %d", (int) hashTypeLength(o));
965 } else if (o->type == OBJ_ZSET) {
966 serverLog(LL_WARNING,"Sorted set size: %d", (int) zsetLength(o));
967 if (o->encoding == OBJ_ENCODING_SKIPLIST)
968 serverLog(LL_WARNING,"Skiplist level: %d", (int) ((const zset*)o->ptr)->zsl->level);
969 } else if (o->type == OBJ_STREAM) {
970 serverLog(LL_WARNING,"Stream size: %d", (int) streamLength(o));
971 }
972#endif
973}
974
975void _serverAssertPrintObject(const robj *o) {
976 bugReportStart();

Callers 2

_serverAssertPrintObjectFunction · 0.85
logCurrentClientFunction · 0.85

Calls 9

sdslenFunction · 0.85
sdscatreprFunction · 0.85
sdsemptyFunction · 0.85
sdsfreeFunction · 0.85
listTypeLengthFunction · 0.85
setTypeSizeFunction · 0.85
hashTypeLengthFunction · 0.85
zsetLengthFunction · 0.85
streamLengthFunction · 0.85

Tested by

no test coverage detected