-
Notifications
You must be signed in to change notification settings - Fork 237
Add ThreadSanitizer support and fixed identified data races #323
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| name: TSAN (ThreadSanitizer) | ||
|
|
||
| # Data race detection using ThreadSanitizer | ||
| # This workflow builds memtier_benchmark with TSAN enabled and runs | ||
| # tests to detect data races and threading issues. | ||
| # | ||
| # NOTE: TSAN currently detects known data races in the codebase. | ||
| # This workflow is informational and will not fail the build. | ||
| # See: https://github.com/google/sanitizers/issues/1716 for TSAN/ASLR issues | ||
|
|
||
| on: [push, pull_request] | ||
|
|
||
| jobs: | ||
| test-with-thread-sanitizer: | ||
| runs-on: ubuntu-latest | ||
| name: Data race detection (TSAN) | ||
| continue-on-error: true # Don't fail build on known races | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Install build dependencies | ||
| run: | | ||
| sudo apt-get -qq update | ||
| sudo apt-get install -y \ | ||
| build-essential \ | ||
| autoconf \ | ||
| automake \ | ||
| pkg-config \ | ||
| libevent-dev \ | ||
| zlib1g-dev \ | ||
| libssl-dev | ||
|
|
||
| - name: Build with Thread Sanitizer | ||
| run: | | ||
| autoreconf -ivf | ||
| ./configure --enable-thread-sanitizer | ||
| make -j | ||
|
|
||
| - name: Verify TSAN is enabled | ||
| run: | | ||
| ldd ./memtier_benchmark | grep tsan | ||
| echo "✓ ThreadSanitizer is linked" | ||
|
|
||
| - name: Setup Python | ||
| uses: actions/setup-python@v2 | ||
| with: | ||
| python-version: '3.10' | ||
| architecture: x64 | ||
|
|
||
| - name: Install Python test dependencies | ||
| run: pip install -r ./tests/test_requirements.txt | ||
|
|
||
| - name: Install Redis | ||
| run: | | ||
| curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg | ||
| echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list | ||
| sudo apt-get -qq update | ||
| sudo apt-get install redis | ||
| sudo service redis-server stop | ||
|
|
||
| - name: Increase connection limit | ||
| run: | | ||
| sudo sysctl -w net.ipv4.tcp_fin_timeout=10 | ||
| sudo sysctl -w net.ipv4.tcp_tw_reuse=1 | ||
| ulimit -n 40960 | ||
|
|
||
| - name: Generate TLS test certificates | ||
| run: ./tests/gen-test-certs.sh | ||
|
|
||
| - name: Test OSS TCP with TSAN | ||
| timeout-minutes: 15 | ||
| run: | | ||
| # Use setarch to disable ASLR (workaround for TSAN on kernel 6.6+) | ||
| # Use suppression file to ignore known benign races | ||
| export TSAN_OPTIONS="suppressions=$(pwd)/tsan_suppressions.txt" | ||
| setarch `uname -m` -R bash -c './tests/run_tests.sh' | ||
|
|
||
| - name: Test OSS TCP TLS with TSAN | ||
| timeout-minutes: 15 | ||
| run: | | ||
| export TSAN_OPTIONS="suppressions=$(pwd)/tsan_suppressions.txt" | ||
| setarch `uname -m` -R bash -c 'TLS=1 ./tests/run_tests.sh' | ||
|
|
||
| - name: Test OSS-CLUSTER TCP with TSAN | ||
| timeout-minutes: 15 | ||
| run: | | ||
| export TSAN_OPTIONS="suppressions=$(pwd)/tsan_suppressions.txt" | ||
| setarch `uname -m` -R bash -c 'OSS_STANDALONE=0 OSS_CLUSTER=1 ./tests/run_tests.sh' | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # ThreadSanitizer suppressions for memtier_benchmark | ||
| # | ||
| # This file contains suppressions for known benign data races that do not | ||
| # affect correctness. These races are intentionally left unfixed for performance. | ||
|
|
||
| # Benign race on stats counters during progress display | ||
| # Worker threads update stats while main thread reads them for progress updates. | ||
| # This is benign because: | ||
| # - Progress stats are approximate and for display only | ||
| # - Final results are collected after pthread_join (race-free) | ||
| # - Adding synchronization would hurt performance | ||
| race:run_stats::set_end_time | ||
| race:run_stats::get_duration_usec | ||
| race:run_stats::get_total_ops | ||
| race:run_stats::get_total_bytes | ||
| race:run_stats::get_total_latency | ||
| race:totals::update_op | ||
|
|
||
| # OpenSSL internal races (false positives in libcrypto) | ||
| # These are known benign races within OpenSSL library itself | ||
| race:libcrypto.so* | ||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.