PyTsan: Automated Data Race Detection in Python Programs
Why this work is in the frame
A frame that forgets how it found something cannot be audited. These are the routes that admitted this work.
Bibliographic record
Abstract
Python and its ecosystem have become integral to modern software development. Despite Python’s popularity, CPython, the reference implementation, has significant performance limitations compared with other widely used programming language implementations. In particular, while CPython supports threads and concurrency, it also uses a global interpreter lock (GIL) to synchronize the execution of Python code. As a result, developers both intentionally and unintentionally overlook subtle synchronization details when writing Python code. In 2023, CPython finally added a build option to compile a “free-threaded” variant of CPython without a GIL. The long-existing GIL minimizes the likelihood of unsynchronized code manifesting as bugs, but such races easily start appearing in a free-threaded build of CPython. In this thesis, we present PyTsan, a dynamic data race detector designed for Python, capable of methodologically detecting hard-to-find data races. When running it on CPython 3.10’s standard library test suite, PyTsan reports 29 data races. Two of those data races were reported by others experimenting with CPython’s new free-threaded build, but had otherwise existed undetected for over 10 years. Furthermore, PyTsan shows that for one of the “fixed” bugs, on architectures other than x86/amd64, such as ARM or RISC-V, the merged resolution is insufficient.
Fetched live from OpenAlex and de-inverted. Abstracts are not stored in this database: the inverted indexes are 8.6 GB of the frame’s 9.3 GB of text, and the host has 13 GB free.
Full frame distilled prediction
Teacher imitationNot calibrated prevalence, not ground truth. Human validation pending. Learned from the 10,348 direct Codex labels and 10,348 direct Gemma labels. Candidate is the union of thresholded teacher heads; consensus is their intersection. These outputs are machine_predicted_unvalidated and are not human labels or direct frontier model labels.
Codex and Gemma teacher scores by category
| Category | Codex | Gemma |
|---|---|---|
| Metaresearch | 0.001 | 0.000 |
| Meta-epidemiology (narrow) | 0.001 | 0.001 |
| Meta-epidemiology (broad) | 0.001 | 0.000 |
| Bibliometrics | 0.001 | 0.004 |
| Science and technology studies | 0.000 | 0.000 |
| Scholarly communication | 0.001 | 0.001 |
| Open science | 0.003 | 0.001 |
| Research integrity | 0.000 | 0.001 |
| Insufficient payload (model declined to judge) | 0.000 | 0.000 |
Machine scores (provisional)
The two teacher heads of the student model, read on this work. A score orders the frame for review; it never asserts a category, and the validation status ships verbatim with every row.
Baseline scores from an immature model (maturity gate not passed, 7 training rounds). Scores rank; they never assert a category.
score_only:v0-immature-baseline · verbatim from the scoring run: score_only means the number may rank works, and no category label ships from it