Closed vashirov closed 3 years ago
I'll have a look at this this morning @vashirov
Looking at the code, the logic hasn't changed between the C / Rust ndn cache:
// Rust
const char *cache_ndn = cache_char_read_get(read_txn, dn);
if (cache_ndn != NULL) {
*ndn = slapi_ch_strdup(cache_ndn);
/*
* We have to complete the read after the strdup else it's
* not safe to access the pointer.
*/
cache_char_read_complete(read_txn);
*rc = 1;
return 1;
} else {
cache_char_read_complete(read_txn);
/* If we miss, we need to duplicate dn to udn here. */
*udn = slapi_ch_strdup(dn);
*rc = 0;
return 0;
}
// C
/* Update that we have a hit.*/
*ndn = slapi_ch_strdup(node->ndn);
/* Indicate to the caller to free this. */
*rc = 1;
ndn_thread_cache_commit_status(t_cache);
return 1;
...
/* If we miss, we need to duplicate dn to udn here. */
*udn = slapi_ch_strdup(dn);
*rc = 0;
ndn_thread_cache_commit_status(t_cache);
return 0;
Does this leak occur when you use --disable-rust? I'm wondering if it's caused by a higher level ....
This leak happens only when built with Rust.
I've also ran some tests with ThreadSanitizer. It reported data races around ndn_cache_lookup
and concread
.
tsan.tar.gz
I see a ton of memory leaks in NDN as well. Now I can not seem to find the NDN Rust code, so I am not sure how it frees the hash tables on shutdown, but it looks NDN has a per thread cache, but it does not take into account the main() thread (only worker threads)! So somewhere in main() we need to free its NDN cache/hash tables, but I don't know how to do that with the Rust plugin.
@mreynolds389 I can have a look at it later, I've just been a bit slow lately.
Any test reports leak in
ndn_cache_lookup ldap/servers/slapd/dn.c:3154
(41697 occurrences)Another occurrence in
dirsrvtests/tests/suites/syncrepl_plugin/basic_test.py::test_sync_repl_cookie_add_del