← 输入框|github.com|刷新
Skip to content

Print each clang-tidy command and its output under a lock - #49

Merged
sawenzel merged 1 commit into
masterfrom
fix-threaded-output
Sep 30, 2026
Merged

sawenzel merged 1 commit into
masterfrom
fix-threaded-output

Conversation

@sawenzel

Copy link
Copy Markdown
Collaborator

run_O2CodeChecker.py wrote to sys.stdout from all threads at once, which corrupts the output with Python 3.9/3.10: NUL bytes and lost lines. In o2checkcode this made grep treat error-log.txt as binary, so the check passed without reading its log (alisw/alidist#6360). Each thread now captures the clang-tidy output and prints it together with the command line under a lock, so each diagnostic also follows its own command.

With a fake clang-tidy over 20000 files at -j 64, Python 3.10 gave ~200k NUL bytes and ~2000 lost lines before, and none after.

Assisted by Claude Code.

This fixes NUL bytes and lost lines in the output of run_O2CodeChecker.py.

- All threads wrote to sys.stdout concurrently, which corrupts it with Python 3.9/3.10.
- With a fake clang-tidy, 20000 files at -j 64 gave ~200k NUL bytes and ~2000 lost lines with Python 3.10.
- Each thread now captures the clang-tidy output and prints it with the command line under a lock.

alisw/alidist#6360

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sawenzel
sawenzel merged commit 40c1855 into master Sep 30, 2026
@sawenzel
sawenzel deleted the fix-threaded-output branch September 30, 2026 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant