|
| 1 | +name: TSAN (ThreadSanitizer) |
| 2 | + |
| 3 | +# Data race detection using ThreadSanitizer |
| 4 | +# This workflow builds memtier_benchmark with TSAN enabled and runs |
| 5 | +# tests to detect data races and threading issues. |
| 6 | +# |
| 7 | +# NOTE: TSAN currently detects known data races in the codebase. |
| 8 | +# This workflow is informational and will not fail the build. |
| 9 | +# See: https://github.com/google/sanitizers/issues/1716 for TSAN/ASLR issues |
| 10 | + |
| 11 | +on: [push, pull_request] |
| 12 | + |
| 13 | +jobs: |
| 14 | + test-with-thread-sanitizer: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + name: Data race detection (TSAN) |
| 17 | + continue-on-error: true # Don't fail build on known races |
| 18 | + steps: |
| 19 | + - name: Checkout code |
| 20 | + uses: actions/checkout@v4 |
| 21 | + |
| 22 | + - name: Install build dependencies |
| 23 | + run: | |
| 24 | + sudo apt-get -qq update |
| 25 | + sudo apt-get install -y \ |
| 26 | + build-essential \ |
| 27 | + autoconf \ |
| 28 | + automake \ |
| 29 | + pkg-config \ |
| 30 | + libevent-dev \ |
| 31 | + zlib1g-dev \ |
| 32 | + libssl-dev |
| 33 | +
|
| 34 | + - name: Build with Thread Sanitizer |
| 35 | + run: | |
| 36 | + autoreconf -ivf |
| 37 | + ./configure --enable-thread-sanitizer |
| 38 | + make -j |
| 39 | +
|
| 40 | + - name: Verify TSAN is enabled |
| 41 | + run: | |
| 42 | + ldd ./memtier_benchmark | grep tsan |
| 43 | + echo "✓ ThreadSanitizer is linked" |
| 44 | +
|
| 45 | + - name: Setup Python |
| 46 | + uses: actions/setup-python@v2 |
| 47 | + with: |
| 48 | + python-version: '3.10' |
| 49 | + architecture: x64 |
| 50 | + |
| 51 | + - name: Install Python test dependencies |
| 52 | + run: pip install -r ./tests/test_requirements.txt |
| 53 | + |
| 54 | + - name: Install Redis |
| 55 | + run: | |
| 56 | + curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg |
| 57 | + 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 |
| 58 | + sudo apt-get -qq update |
| 59 | + sudo apt-get install redis |
| 60 | + sudo service redis-server stop |
| 61 | +
|
| 62 | + - name: Increase connection limit |
| 63 | + run: | |
| 64 | + sudo sysctl -w net.ipv4.tcp_fin_timeout=10 |
| 65 | + sudo sysctl -w net.ipv4.tcp_tw_reuse=1 |
| 66 | + ulimit -n 40960 |
| 67 | +
|
| 68 | + - name: Generate TLS test certificates |
| 69 | + run: ./tests/gen-test-certs.sh |
| 70 | + |
| 71 | + - name: Test OSS TCP with TSAN |
| 72 | + timeout-minutes: 15 |
| 73 | + run: | |
| 74 | + # Use setarch to disable ASLR (workaround for TSAN on kernel 6.6+) |
| 75 | + # Use suppression file to ignore known benign races |
| 76 | + export TSAN_OPTIONS="suppressions=$(pwd)/tsan_suppressions.txt" |
| 77 | + setarch `uname -m` -R bash -c './tests/run_tests.sh' |
| 78 | +
|
| 79 | + - name: Test OSS TCP TLS with TSAN |
| 80 | + timeout-minutes: 15 |
| 81 | + run: | |
| 82 | + export TSAN_OPTIONS="suppressions=$(pwd)/tsan_suppressions.txt" |
| 83 | + setarch `uname -m` -R bash -c 'TLS=1 ./tests/run_tests.sh' |
| 84 | +
|
| 85 | + - name: Test OSS-CLUSTER TCP with TSAN |
| 86 | + timeout-minutes: 15 |
| 87 | + run: | |
| 88 | + export TSAN_OPTIONS="suppressions=$(pwd)/tsan_suppressions.txt" |
| 89 | + setarch `uname -m` -R bash -c 'OSS_STANDALONE=0 OSS_CLUSTER=1 ./tests/run_tests.sh' |
| 90 | +
|
0 commit comments