[8.6] MOD-7574: Output Current Thread IndexSpec Information On Crash#8114
Conversation
* initial commit * remove redundant index name since it will be added in the info function * fix compilation * fix code review comment + change function name * add how long the thread was running on an index * fixing minor bug in syn dump command * add init call, add time to test * use existing IndexSpec_AddToInfo, modify it a bit to ensure it is signal safe and obfuscates user data * update test * fix cursor stats for info function * fix compilation and comments * fix test + update comment * fix code review comments * code review fixes * fix tests * can't use IndexesScanner_IndexedPercent because we don't have redis module ctx (cherry picked from commit 6ad5523)
| const char *prefix = HiddenUnicodeString_GetUnsafe(rule->prefixes[i], NULL); | ||
| const char *prefix_to_use = obfuscate ? Obfuscate_Prefix(prefix) : prefix; | ||
| prefixes = array_ensure_append_1(prefixes, "\""); | ||
| prefixes = array_ensure_append_n(prefixes, prefix_to_use, strlen(prefix_to_use)); |
There was a problem hiding this comment.
Missing NULL check for prefixes in loop
Low Severity
The new prefix handling code checks first_prefix for NULL at line 2893-2894 before entering the loop, but inside the loop, prefix obtained from HiddenUnicodeString_GetUnsafe is not checked for NULL. When obfuscate is false, prefix_to_use equals prefix directly, and strlen(prefix_to_use) is called at line 2901. If HiddenUnicodeString_GetUnsafe returns NULL for any subsequent prefix, this causes undefined behavior.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 8.6 #8114 +/- ##
==========================================
- Coverage 84.02% 83.76% -0.26%
==========================================
Files 365 365
Lines 55111 55277 +166
Branches 14296 14296
==========================================
- Hits 46305 46303 -2
- Misses 8645 8813 +168
Partials 161 161
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Description
Backport of #8051 to
8.6.Note
Backports crash-report improvements and INFO safety hardening.
IndexSpec_AddToInfo(ctx, sp, obfuscate, skip_unsafe_ops)surfaces index definition/stats without allocations/locks; used incurrent_threadcrash section withrun_time_nstracking (viaSpecInfo.runningTime).Obfuscate_Prefixand integrates obfuscation for filters, prefixes, field names/paths; supportsskip_unsafe_opsto bypass risky ops (e.g., vector sizes, stopwords, dict lookups) in signal handlers.Cursors_RenderStatsForInfousestrylockand reportsstatus=lockedif contention; GCrenderStatsForInfoalways available and wired in callbacks.CurrentThread_SetIndexSpecusage.Written by Cursor Bugbot for commit 80a21b9. This will update automatically on new commits. Configure here.