Skip to content

Conversation

@fcostaoliveira
Copy link
Collaborator

@fcostaoliveira fcostaoliveira commented Nov 14, 2025

This PR adds memory leak detection to the CI pipeline using AddressSanitizer (ASAN) and LeakSanitizer (LSAN). It also include local dev how-to placed inside the Readme.

Furthermore, just by running it we've caught a leak (very small one of 10B) in uri usage.

 	debug:	==7533==ERROR: LeakSanitizer: detected memory leaks
	debug:	
	debug:	Direct leak of 10 byte(s) in 1 object(s) allocated from:
	debug:	    #0 0x7f9d31af74e8 in strdup ../../../../src/libsanitizer/asan/asan_interceptors.cpp:578
	debug:	    #1 0x55a8f5521454 in parse_uri /home/runner/work/memtier_benchmark/memtier_benchmark/memtier_benchmark.cpp:391
	debug:	    #2 0x55a8f5521454 in main /home/runner/work/memtier_benchmark/memtier_benchmark/memtier_benchmark.cpp:1523
	debug:	    #3 0x7f9d30c2a1c9  (/lib/x86_64-linux-gnu/libc.so.6+0x2a1c9) (BuildId: 274eec488d230825a136fa9c4d85370fed7a0a5e)
	debug:	    #4 0x7f9d30c2a28a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28a) (BuildId: 274eec488d230825a136fa9c4d85370fed7a0a5e)
	debug:	    #5 0x55a8f55188e4 in _start (/home/runner/work/memtier_benchmark/memtier_benchmark/memtier_benchmark+0x148e4) (BuildId: 68811aba3179c25bdd8473c5efd53cf1ae64f831)
	debug:	
	debug:	SUMMARY: AddressSanitizer: 10 byte(s) leaked in 1 allocation(s).

This confirms the automation is working and usefull.

Changes

Build System

  • Added --enable-sanitizers configure option to enable ASAN/LSAN
  • When enabled, automatically adds appropriate compiler and linker flags
  • Default build behavior unchanged (sanitizers are opt-in)

CI Pipeline

  • Added new workflow .github/workflows/asan.yml
  • Runs on ubuntu-latest for all pushes and pull requests
  • Builds memtier_benchmark with sanitizers enabled
  • Executes full test suite with leak detection:
    • OSS TCP and TLS (v1.2, v1.3)
    • OSS-CLUSTER TCP and TLS
  • Build fails if any memory leaks or errors are detected

Test Dependencies

  • Removed external mbdirector dependency given it conflicted with rltest versioning
  • Replaced with local implementation in tests/mb.py
  • Upgraded rltest from 0.6.0 to >=0.7.17

Testing

All tests pass cleanly with ASAN/LSAN enabled, confirming no memory leaks in the current codebase.

Local verification:

./configure --enable-sanitizers
make -j
ASAN_OPTIONS=detect_leaks=1 ./tests/run_tests.sh

Copy link
Collaborator

@paulorsousa paulorsousa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 👏

@fcostaoliveira fcostaoliveira merged commit beea70e into RedisLabs:master Nov 14, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants