Skip to content

Fix entity renumbering in util/parse_tsan.py

util/parse_tsan.py builds tables of mutexes, threads, and pointers it finds in the TSAN report provided to it as a command-line argument and then replaces all mentions of each of these entities so that they are numbered sequentially in the processed report. For example, this line:

Cycle in lock order graph: M0 (...) => M5 (...) => M9 (...) => M0

is expected to become:

Cycle in lock order graph: M1 (...) => M2 (...) => M3 (...) => M1

Problems arise when the gaps between mutex/thread identifiers present on a single line are smaller than the total number of mutexes/threads found by the script so far. For example, the following line:

Cycle in lock order graph: M0 (...) => M1 (...) => M2 (...) => M0

first gets turned into:

Cycle in lock order graph: M1 (...) => M1 (...) => M2 (...) => M1

and then into:

Cycle in lock order graph: M2 (...) => M2 (...) => M2 (...) => M2

In other words, lines like this become garbled due to information loss.

The problem stems from the fact that the numbering scheme the script uses for identifying mutexes and threads is exactly the same as the one used by TSAN itself. Update util/parse_tsan.py so that it uses zero-padded numbers instead, making the "overlapping" demonstrated above impossible.

Closes #4150 (closed)

Edited by Michał Kępień

Merge request reports