[all-commits] [llvm/llvm-project] a3292e: [lldb] Fix TestThreadExit.py flakiness (#190976)

Jonas Devlieghere via All-commits all-commits at lists.llvm.org
Fri Apr 17 14:00:36 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a3292e8924528420989c23a8e79174f9b9cb3840
      https://github.com/llvm/llvm-project/commit/a3292e8924528420989c23a8e79174f9b9cb3840
  Author: Jonas Devlieghere <jonas at devlieghere.com>
  Date:   2026-04-17 (Fri, 17 Apr 2026)

  Changed paths:
    A lldb/packages/Python/lldbsuite/test/make/mach_thread.h
    M lldb/test/API/functionalities/thread/thread_exit/main.cpp

  Log Message:
  -----------
  [lldb] Fix TestThreadExit.py flakiness (#190976)

When `pthread_join` returns, the target thread signals its internal
semaphore, but the underlying Mach thread hasn't been removed from the
task yet with `thread_terminate`.

The flakiness is the result of the debugger stopping the process halts
the dying thread mid-termination. There is no Mach API to distinguish a
dying thread from a live one: it appears as `TH_STATE_STOPPED`, like any
other suspended thread.

This PR adds a helper (`wait_for_thread_cleanup`) that polls
`task_threads` to ensure the Mach thread is actually gone before the
breakpoint. Since there might be other tests that are affected by this
race, I put it in a common location so it can be reused.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list