| 1045 | } |
| 1046 | |
| 1047 | void serverLogObjectDebugInfo(robj_roptr o) { |
| 1048 | serverLog(LL_WARNING,"Object type: %d", o->type); |
| 1049 | serverLog(LL_WARNING,"Object encoding: %d", o->encoding); |
| 1050 | serverLog(LL_WARNING,"Object refcount: %d", static_cast<int>(o->getrefcount(std::memory_order_relaxed))); |
| 1051 | #if UNSAFE_CRASH_REPORT |
| 1052 | /* This code is now disabled. o->ptr may be unreliable to print. in some |
| 1053 | * cases a ziplist could have already been freed by realloc, but not yet |
| 1054 | * updated to o->ptr. in other cases the call to ziplistLen may need to |
| 1055 | * iterate on all the items in the list (and possibly crash again). |
| 1056 | * For some cases it may be ok to crash here again, but these could cause |
| 1057 | * invalid memory access which will bother valgrind and also possibly cause |
| 1058 | * random memory portion to be "leaked" into the logfile. */ |
| 1059 | if (o->type == OBJ_STRING && sdsEncodedObject(o)) { |
| 1060 | serverLog(LL_WARNING,"Object raw string len: %zu", sdslen(szFromObj(o))); |
| 1061 | if (sdslen(szFromObj(o)) < 4096) { |
| 1062 | sds repr = sdscatrepr(sdsempty(),szFromObj(o),sdslen(szFromObj(o))); |
| 1063 | serverLog(LL_WARNING,"Object raw string content: %s", repr); |
| 1064 | sdsfree(repr); |
| 1065 | } |
| 1066 | } else if (o->type == OBJ_LIST) { |
| 1067 | serverLog(LL_WARNING,"List length: %d", (int) listTypeLength(o)); |
| 1068 | } else if (o->type == OBJ_SET) { |
| 1069 | serverLog(LL_WARNING,"Set size: %d", (int) setTypeSize(o)); |
| 1070 | } else if (o->type == OBJ_HASH) { |
| 1071 | serverLog(LL_WARNING,"Hash size: %d", (int) hashTypeLength(o)); |
| 1072 | } else if (o->type == OBJ_ZSET) { |
| 1073 | serverLog(LL_WARNING,"Sorted set size: %d", (int) zsetLength(o)); |
| 1074 | if (o->encoding == OBJ_ENCODING_SKIPLIST) |
| 1075 | serverLog(LL_WARNING,"Skiplist level: %d", (int) ((const zset*)ptrFromObj(o))->zsl->level); |
| 1076 | } else if (o->type == OBJ_STREAM) { |
| 1077 | serverLog(LL_WARNING,"Stream size: %d", (int) streamLength(o)); |
| 1078 | } |
| 1079 | #endif |
| 1080 | } |
| 1081 | |
| 1082 | void _serverAssertPrintObject(robj_roptr o) { |
| 1083 | bugReportStart(); |
no test coverage detected