-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
(C API) Segfault when calling rocksdb_slicetransform_destroy() after rocksdb_options_set_prefix_extractor() #1095
Comments
The segfault also occurs with the bloom filter policies also, and possibly more. However it does not occur with block based table options. And here is what appears to be the difference: The following seems to be OK: void rocksdb_options_set_block_based_table_factory(
rocksdb_options_t *opt,
rocksdb_block_based_table_options_t* table_options) {
if (table_options) {
opt->rep.table_factory.reset(
rocksdb::NewBlockBasedTableFactory(table_options->rep));
}
} The following eventually results in segfault: void rocksdb_options_set_prefix_extractor(
rocksdb_options_t* opt, rocksdb_slicetransform_t* prefix_extractor) {
opt->rep.prefix_extractor.reset(prefix_extractor);
} Is there any reason why the latter can't be made to work like the former? |
…(rocksdb issue #1095 facebook/rocksdb#1095) will cause them to be doubly destroyed. Better to leak than to segfault.
…(rocksdb issue #1095 facebook/rocksdb#1095) will cause them to be doubly destroyed. Better to leak than to segfault.
Closing this via automation due to lack of activity. If discussion is still needed here, please re-open or create a new/updated issue. |
Reference: facebook/rocksdb#1095 The cst has alredy been consumed when associated with the prefix_extractor
The code below will segfault.
The expectation is that a call to rocksdb_slicetransform_create_fixed_prefix() should be paired with a call to rocksdb_slicetransform_destroy().
However, once the rocksdb_slicetransform_t is associated with an rocksdb_options_t, it gets destroyed when the rocksdb_options_t is destroyed, and so if you call rocksdb_slicetransform_destroy() it segfaults.
This makes language bindings exceedingly clumsy as you have to keep track of whether the rocksdb_slicetransform_t has been associated with a rocksdb_options_t somewhere.
Is this desired behavior?
The text was updated successfully, but these errors were encountered: