| 938 | } |
| 939 | |
| 940 | void 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 | |
| 975 | void _serverAssertPrintObject(const robj *o) { |
| 976 | bugReportStart(); |
no test coverage detected