tp: fix flaky TempDir teardown crash in integration tests#6547
Merged
Conversation
LalitMaganti
approved these changes
Jul 6, 2026
🎨 Perfetto UI Builds
|
The perfetto_integrationtests binary was flakily aborting (SIGILL, exit 132) on sanitizer builds with: temp_file.cc:154 PERFETTO_CHECK(Rmdir(path_)) (errno: 39, Directory not empty) TempDir's destructor CHECKs that its directory is empty, so any leftover file there takes down the whole binary. Two independent leaks caused this: 1. `server unix` registered its "<socket>.pid" path with the SIGTERM handler only after creating the file and setting up the listen socket and idle reaper. A SIGTERM in that window unlinked the socket but left the pid file behind, and ServerUnixBindAndCleanup then aborted on the non-empty TempDir. The socket is still removed, so the test's WaitForFileState guard passes and nothing looks wrong until teardown. The window is tiny normally but widens under ASan/MSan. Register the pid path before creating the file, mirroring the socket path. 2. Several tests removed a file from a TempDir only at the end of the test body, which is skipped if an ASSERT above returns early. Move those to OnScopeExit so cleanup always runs (traced multi-producer-socket test and the trace_processor `bundle` tests). https://github.com/google/perfetto/actions/runs/28811487303/job/85440268082?pr=6547
8fd3246 to
526c035
Compare
LalitMaganti
approved these changes
Jul 6, 2026
LalitMaganti
approved these changes
Jul 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The perfetto_integrationtests binary was flakily aborting (SIGILL, exit
132) on sanitizer builds with:
temp_file.cc:154 PERFETTO_CHECK(Rmdir(path_)) (errno: 39, Directory not empty)
TempDir's destructor CHECKs that its directory is empty, so any leftover
file there takes down the whole binary. Two independent leaks caused this:
server unixregistered its ".pid" path with the SIGTERMhandler only after creating the file and setting up the listen socket
and idle reaper. A SIGTERM in that window unlinked the socket but left
the pid file behind, and ServerUnixBindAndCleanup then aborted on the
non-empty TempDir. The socket is still removed, so the test's
WaitForFileState guard passes and nothing looks wrong until teardown.
The window is tiny normally but widens under ASan/MSan. Register the
pid path before creating the file, mirroring the socket path.
Several tests removed a file from a TempDir only at the end of the test
body, which is skipped if an ASSERT above returns early. Move those to
OnScopeExit so cleanup always runs (traced multi-producer-socket test
and the trace_processor
bundletests).https://github.com/google/perfetto/actions/runs/28811487303/job/85440268082?pr=6547
Bug: 530236105