Skip to content

tp: fix flaky TempDir teardown crash in integration tests#6547

Merged
sashwinbalaji merged 1 commit into
mainfrom
dev/sashwinbalaji/flaky_test
Jul 6, 2026
Merged

tp: fix flaky TempDir teardown crash in integration tests#6547
sashwinbalaji merged 1 commit into
mainfrom
dev/sashwinbalaji/flaky_test

Conversation

@sashwinbalaji

@sashwinbalaji sashwinbalaji commented Jul 6, 2026

Copy link
Copy Markdown
Member

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 ".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

Bug: 530236105

@sashwinbalaji sashwinbalaji enabled auto-merge (squash) July 6, 2026 17:47
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

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
@sashwinbalaji sashwinbalaji force-pushed the dev/sashwinbalaji/flaky_test branch from 8fd3246 to 526c035 Compare July 6, 2026 18:44
@sashwinbalaji sashwinbalaji requested a review from a team as a code owner July 6, 2026 18:44
@sashwinbalaji sashwinbalaji changed the title perfetto: fix TempDir teardown crash in traced integration tests tp: fix flaky TempDir teardown crash in integration tests Jul 6, 2026
@sashwinbalaji sashwinbalaji merged commit d742ee3 into main Jul 6, 2026
44 of 47 checks passed
@sashwinbalaji sashwinbalaji deleted the dev/sashwinbalaji/flaky_test branch July 6, 2026 19:31
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.

2 participants