-
Notifications
You must be signed in to change notification settings - Fork 113
Issue 7126 - WARN - keys2idl - received NULL idl from index_read_ext_allids #7127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey there - I've reviewed your changes - here's some feedback:
- The new
idl == NULLcheck inside the retry loop is redundant with the finalidl == NULLcheck before return; you can likely drop the earlier allocation to keep the control flow and allocation behavior simpler while still guaranteeing a non-NULL return. - When logging
basetypein the new warning, consider guarding against a NULL pointer (or using a safe fallback string) to avoid introducing a potential NULL dereference in the error path.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new `idl == NULL` check inside the retry loop is redundant with the final `idl == NULL` check before return; you can likely drop the earlier allocation to keep the control flow and allocation behavior simpler while still guaranteeing a non-NULL return.
- When logging `basetype` in the new warning, consider guarding against a NULL pointer (or using a safe fallback string) to avoid introducing a potential NULL dereference in the error path.
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
droideck
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, there are a few more return NULL exists beside the main code path.
I don't have a strong opinion here though... So if you checked it under a high contention and the errors are gone, - I'm okay with that
Yet, it'd be nice to clean up the logic a bit as some of the function's callers don't do any NULL checks.
tbordaz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with @droideck basetmp comments.
Except that LGTM
…allids Bug Description: Under high concurrency, occasional NULL IDL warnings were logged: [29/Nov/2025:22:59:13.930441639 +0000] - WARN - keys2idl - received NULL idl from index_read_ext_allids, treating as empty set [29/Nov/2025:22:59:13.936543122 +0000] - WARN - keys2idl - this is probably a bug that should be reported [29/Nov/2025:22:59:13.947131944 +0000] - ERR - build_candidate_list - Database error -12795 Fix Description: Ensure idl returned by `index_read_ext_allids()` is never NULL. Fixes: 389ds#7126
All early exits now return empty IDL idl_alloc(1) instead of NULL Moved `slapi_ch_free_string(&basetmp)` to avoid use-after-free
8f82c85 to
8326081
Compare
I agree, There are some checks for NULL IDL in
and
Since we changed the return type, I think we should adjust these as well, correct? |
droideck
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
droideck
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a note, the new commit message has a typo - idl_alloc(1) instead of idl_alloc(0).
Also a dead code in
389-ds-base/ldap/servers/slapd/back-ldbm/filterindex.c
Lines 1160 to 1164 in 8fe7bfe
| if (idl2 == NULL) { | |
| slapi_log_err(SLAPI_LOG_WARNING, "keys2idl", "received NULL idl from index_read_ext_allids, treating as empty set\n"); | |
| slapi_log_err(SLAPI_LOG_WARNING, "keys2idl", "this is probably a bug that should be reported\n"); | |
| idl2 = idl_alloc(0); | |
| } |
I'm not fully sure... IIUC, an empty ID list is perfectly valid for these cases and we can treat an empty-but-valid IDL (zero count, *err == 0) as a normal result. @progier389 @tbordaz WDYT? |
Bug Description:
Under high concurrency, occasional NULL IDL warnings were logged:
Fix Description:
Ensure idl returned by
index_read_ext_allids()is never NULL.Fixes: #7126