-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
KeyMayExist dumps core when value pointer is null #13048
Comments
hi @mdcallag , The issue arises from the sample code accessing the incorrect overload of the KeyMayExist method. There are two overloaded functions: one that includes a timestamp and one that does not. // If the key definitely does not exist in the database, then this method
the second overload, which omits the timestamp, works as expected because it handles without requiring a valid pointer for the value. Therefore, to achieve the desired functionality, the method without the timestamp should be called. |
Still get a core dump after I changed my testcase to use the method without a timestamp
New diff is:
|
In the context of RocksDB, I see the DB class serves as the public interface that users interact with, while the DBImpl class contains the actual implementation details. The assertion assert(value != nullptr); is a safety check designed to ensure that the pointer value is not nullptr before proceeding with further operations that assume it points to a valid memory location. |
Expected behavior
I expect no core dump when the value pointer is NULL.
I assume it should be safe to pass NULL for the value pointer in cases where I don't want to get the value. Otherwise, this method has no purpose because if I must fetch the value then I can use Get(). Also, the comments imply that I can pass NULL (see here) and the comment includes this text.
Actual behavior
I get a segfault when the value pointer is null with this command line: ./db_bench --benchmarks=fillseq,readrandomfast
After applying this diff:
And the stack trace
Steps to reproduce the behavior
The text was updated successfully, but these errors were encountered: