Memory leaks in configurator
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 122
- Forks
- 34
- PR merge metrics
- No merged PRs in 30d
Description
### System information
Type | Version/Name
--- | ---
Operating System | Linux
OS Version | Ubuntu-21.04
Architecture | x86_64
UnifyFS Version | -devel
### Describe the problem you're observing
Merely initializing and finalizing unify causes memory sanitizers (valgrind, address sanitizer) to report memory leaks
### Describe how to reproduce the problem
`valgrind --leak-check=full --show-reachable=yes` will uncover leaked memory as will compiling with `-fsanitize=address`
### Include any warning or errors or releveant debugging data
This simple routine initializes and finalizes unify
```
#include
int main(int argc, char **argv)
{
const char * unify_prefix = "/unify-demo";
char filename[256];
unifyfs_handle fshdl = UNIFYFS_INVALID_HANDLE;
int ret = unifyfs_initialize(unify_prefix, NULL, 0, &fshdl);
ret = unifyfs_finalize(fshdl);
return ret;
}
```
and when compiled with `-fsanitized=address`, I get the following leaks in the unify configurator
```
=================================================================
==14725==ERROR: LeakSanitizer: detected memory leaks
Direct leak of 59 byte(s) in 1 object(s) allocated from:
#0 0x7f50cc79d9f7 in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:454
#1 0x7f50cc715ff8 in unifyfs_config_process_environ /home/robl/work/UnifyFS/client/src/../../common/src/unifyfs_configurator.c:437
Direct leak of 32 byte(s) in 2 object(s) allocated from:
#0 0x7f50cc7f6e17 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
#1 0x7f50cc718138 in configurator_int_check /home/robl/work/UnifyFS/client/src/../../common/src/unifyfs_configurator.c:1013
#2 0x7f50cc718138 in configurator_int_check /home/robl/work/UnifyFS/client/src/../../common/src/unifyfs_configurator.c:994
Direct leak of 13 byte(s) in 1 object(s) allocated from:
#0 0x7f50cc79d9f7 in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:454
#1 0x7f50cc7150bc in unifyfs_config_set_defaults /home/robl/work/UnifyFS/client/src/../../common/src/unifyfs_configurator.c:228
Direct leak of 12 byte(s) in 1 object(s) allocated from:
#0 0x7f50cc79d9f7 in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:454
#1 0x7f50cc731d46 in unifyfs_initialize /home/robl/work/UnifyFS/client/src/unifyfs_api.c:53
Direct leak of 12 byte(s) in 1 object(s) allocated from:
#0 0x7f50cc79d9f7 in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:454
#1 0x7f50cc72b85c in invoke_client_metaget_rpc /home/robl/work/UnifyFS/client/src/margo_client.c:494
Direct leak of 10 byte(s) in 1 object(s) allocated from:
#0 0x7f50cc79d9f7 in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:454
#1 0x7f50cc71501c in unifyfs_config_set_defaults /home/robl/work/UnifyFS/client/src/../../common/src/unifyfs_configurator.c:228
Direct leak of 9 byte(s) in 1 object(s) allocated from:
#0 0x7f50cc79d9f7 in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:454
#1 0x7f50cc715161 in unifyfs_config_set_defaults /home/robl/work/UnifyFS/client/src/../../common/src/unifyfs_configurator.c:228
Direct leak of 9 byte(s) in 1 object(s) allocated from:
#0 0x7f50cc79d9f7 in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:454
#1 0x7f50cc715ca4 in unifyfs_config_process_environ /home/robl/work/UnifyFS/client/src/../../common/src/unifyfs_configurator.c:437
Direct leak of 8 byte(s) in 1 object(s) allocated from:
#0 0x7f50cc79d9f7 in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:454
#1 0x7f50cc71514e in unifyfs_config_set_defaults /home/robl/work/UnifyFS/client/src/../../common/src/unifyfs_configurator.c:228
Direct leak of 5 byte(s) in 1 object(s) allocated from:
#0 0x7f50cc79d9f7 in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:454
#1 0x7f50cc715f41 in unifyfs_config_process_environ /home/robl/work/UnifyFS/client/src/../../common/src/unifyfs_configurator.c:437
Direct leak of 5 byte(s) in 1 object(s) allocated from:
#0 0x7f50cc79d9f7 in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:454
#1 0x7f50cc7150cc in unifyfs_config_set_defaults /home/robl/work/UnifyFS/client/src/../../common/src/unifyfs_configurator.c:228
Direct leak of 4 byte(s) in 1 object(s) allocated from:
#0 0x7f50cc79d9f7 in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:454
#1 0x7f50cc71508c in unifyfs_config_set_defaults /home/robl/work/UnifyFS/client/src/../../common/src/unifyfs_configurator.c:228
Direct leak of 4 byte(s) in 1 object(s) allocated from:
#0 0x7f50cc79d9f7 in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:454
#1 0x7f50cc71506c in unifyfs_config_set_defaults /home/robl/work/UnifyFS/client/src/../../common/src/unifyfs_configurator.c:228
Direct leak of 4 byte(s) in 1 object(s) allocated from:
#0 0x7f50cc79d9f7 in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:454
#1 0x7f50cc715128 in unifyfs_config_set_defaults /home/robl/work/UnifyFS/client/src/../../common/src/unifyfs_configurator.c:228
Direct leak of 4 byte(s) in 1 object(s) allocated from:
#0 0x7f50cc79d9f7 in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:454
#1 0x7f50cc71502c in unifyfs_config_set_defaults /home/robl/work/UnifyFS/client/src/../../common/src/unifyfs_configurator.c:228
Direct leak of 4 byte(s) in 1 object(s) allocated from:
#0 0x7f50cc79d9f7 in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:454
#1 0x7f50cc7150dc in unifyfs_config_set_defaults /home/robl/work/UnifyFS/client/src/../../common/src/unifyfs_configurator.c:228
Direct leak of 4 byte(s) in 1 object(s) allocated from:
#0 0x7f50cc79d9f7 in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:454
#1 0x7f50cc71505c in unifyfs_config_set_defaults /home/robl/work/UnifyFS/client/src/../../common/src/unifyfs_configurator.c:228
Direct leak of 4 byte(s) in 1 object(s) allocated from:
#0 0x7f50cc79d9f7 in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:454
#1 0x7f50cc714ffc in unifyfs_config_set_defaults /home/robl/work/UnifyFS/client/src/../../common/src/unifyfs_configurator.c:228
Direct leak of 4 byte(s) in 1 object(s) allocated from:
#0 0x7f50cc79d9f7 in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:454
#1 0x7f50cc715187 in unifyfs_config_set_defaults /home/robl/work/UnifyFS/client/src/../../common/src/unifyfs_configurator.c:228
Direct leak of 4 byte(s) in 1 object(s) allocated from:
#0 0x7f50cc79d9f7 in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:454
#1 0x7f50cc715174 in unifyfs_config_set_defaults /home/robl/work/UnifyFS/client/src/../../common/src/unifyfs_configurator.c:228
Direct leak of 3 byte(s) in 1 object(s) allocated from:
#0 0x7f50cc79d9f7 in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:454
#1 0x7f50cc71513b in unifyfs_config_set_defaults /home/robl/work/UnifyFS/client/src/../../common/src/unifyfs_configurator.c:228
Direct leak of 3 byte(s) in 1 object(s) allocated from:
#0 0x7f50cc79d9f7 in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:454
#1 0x7f50cc71504c in unifyfs_config_set_defaults /home/robl/work/UnifyFS/client/src/../../common/src/unifyfs_configurator.c:228
Direct leak of 3 byte(s) in 1 object(s) allocated from:
#0 0x7f50cc79d9f7 in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:454
#1 0x7f50cc71509c in unifyfs_config_set_defaults /home/robl/work/UnifyFS/client/src/../../common/src/unifyfs_configurator.c:228
Direct leak of 2 byte(s) in 1 object(s) allocated from:
#0 0x7f50cc79d9f7 in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:454
#1 0x7f50cc715f7e in unifyfs_config_process_environ /home/robl/work/UnifyFS/client/src/../../common/src/unifyfs_configurator.c:437
Direct leak of 2 byte(s) in 1 object(s) allocated from:
#0 0x7f50cc79d9f7 in __interceptor_strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:454
#1 0x7f50cc715e5c in unifyfs_config_process_environ /home/robl/work/UnifyFS/client/src/../../common/src/unifyfs_configurator.c:437
SUMMARY: AddressSanitizer: 223 byte(s) leaked in 26 allocation(s).
```
priority: low -- 223 bytes is a trivial amount of memory. they are more annoyances when I'm trying to find my own memory leaks
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the report with valgrind --leak-check=full --show-reachable=yes or AddressSanitizer using the shown unifyfs_initialize/unifyfs_finalize program. Inspect the allocation sites named in common/src/unifyfs_configurator.c, client/src/unifyfs_api.c, and client/src/margo_client.c, then trace their ownership through finalization. Done means initialization and finalization no longer report the listed leaks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100