Skip to content

Commit b88889e

Browse files
authored
pythongh-117657: Log TSAN warnings to separate files and archive them (python#118747)
This ensures we don't lose races that occur in subprocesses or interleave races from workers running in parallel. Log files are collected and packaged into a zipfile that can be downloaded from the "Artifacts" section of the workflow run.
1 parent a019347 commit b88889e

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,7 @@ jobs:
486486
config_hash: ${{ needs.check_source.outputs.config_hash }}
487487
options: ./configure --config-cache --with-thread-sanitizer --with-pydebug
488488
suppressions_path: Tools/tsan/supressions.txt
489+
tsan_logs_artifact_name: tsan-logs-default
489490

490491
build_tsan_free_threading:
491492
name: 'Thread sanitizer (free-threading)'
@@ -496,6 +497,7 @@ jobs:
496497
config_hash: ${{ needs.check_source.outputs.config_hash }}
497498
options: ./configure --config-cache --disable-gil --with-thread-sanitizer --with-pydebug
498499
suppressions_path: Tools/tsan/suppressions_free_threading.txt
500+
tsan_logs_artifact_name: tsan-logs-free-threading
499501

500502
# CIFuzz job based on https://google.github.io/oss-fuzz/getting-started/continuous-integration/
501503
cifuzz:

.github/workflows/reusable-tsan.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ on:
1111
description: 'A repo relative path to the suppressions file'
1212
required: true
1313
type: string
14+
tsan_logs_artifact_name:
15+
description: 'Name of the TSAN logs artifact. Must be unique for each job.'
16+
required: true
17+
type: string
1418

1519
jobs:
1620
build_tsan_reusable:
@@ -41,7 +45,7 @@ jobs:
4145
sudo sysctl -w vm.mmap_rnd_bits=28
4246
- name: TSAN Option Setup
4347
run: |
44-
echo "TSAN_OPTIONS=suppressions=${GITHUB_WORKSPACE}/${{ inputs.suppressions_path }}" >> $GITHUB_ENV
48+
echo "TSAN_OPTIONS=log_path=${GITHUB_WORKSPACE}/tsan_log suppressions=${GITHUB_WORKSPACE}/${{ inputs.suppressions_path }} handle_segv=0" >> $GITHUB_ENV
4549
echo "CC=clang" >> $GITHUB_ENV
4650
echo "CXX=clang++" >> $GITHUB_ENV
4751
- name: Add ccache to PATH
@@ -60,3 +64,13 @@ jobs:
6064
run: make pythoninfo
6165
- name: Tests
6266
run: ./python -m test --tsan -j4
67+
- name: Display TSAN logs
68+
if: always()
69+
run: find ${GITHUB_WORKSPACE} -name 'tsan_log.*' | xargs head -n 1000
70+
- name: Archive TSAN logs
71+
if: always()
72+
uses: actions/upload-artifact@v4
73+
with:
74+
name: ${{ inputs.tsan_logs_artifact_name }}
75+
path: tsan_log.*
76+
if-no-files-found: ignore

Tools/tsan/supressions.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22
# reference: https://github.com/google/sanitizers/wiki/ThreadSanitizerSuppressions
33
race:get_allocator_unlocked
44
race:set_allocator_unlocked
5+
6+
# https://gist.github.com/mpage/daaf32b39180c1989572957b943eb665
7+
thread:pthread_create

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy