[all-commits] [llvm/llvm-project] 3cb964: [llvm-jitlink] Shut down the session on an error r...

Lang Hames via All-commits all-commits at lists.llvm.org
Wed Jan 8 16:46:30 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3cb9648420fde52a4bcd429f5c1d174cd06051e7
      https://github.com/llvm/llvm-project/commit/3cb9648420fde52a4bcd429f5c1d174cd06051e7
  Author: Lang Hames <lhames at gmail.com>
  Date:   2025-01-09 (Thu, 09 Jan 2025)

  Changed paths:
    M llvm/tools/llvm-jitlink/llvm-jitlink.cpp

  Log Message:
  -----------
  [llvm-jitlink] Shut down the session on an error return path.

Ensures cleanup of task dispatcher threads. This may address some of the
nondeterministic failures seen in llvm-jitlink regression tests recently.


  Commit: 831287620567559e7078cb7f4cd1962d35c49893
      https://github.com/llvm/llvm-project/commit/831287620567559e7078cb7f4cd1962d35c49893
  Author: Lang Hames <lhames at gmail.com>
  Date:   2025-01-09 (Thu, 09 Jan 2025)

  Changed paths:
    M llvm/include/llvm/ExecutionEngine/Orc/TaskDispatch.h
    M llvm/lib/ExecutionEngine/Orc/TaskDispatch.cpp

  Log Message:
  -----------
  [ORC] Fix Task cleanup during DynamicThreadPoolTaskDispatcher::shutdown.

Threads created by DynamicThreadPoolTaskDispatcher::dispatch had been holding a
unique_ptr to the most recent Task, meaning that the Task would be destroyed
when the thread object was destroyed, but this would happen *after* the thread
signaled the Dispatcher that it was finished. This could cause
DynamicThreadPoolTaskDispatcher::shutdown to return (and consequently
ExecutionSession to be destroyed) before all Tasks were destroyed, with Task
destructors accessing ExecutionSession and related objects after they were
freed.

The fix is to reset the Task pointer immediately after it is run to trigger
cleanup, *then* (if there are no other tasks to run) signal the Dispatcher that
the thread is finished.

This patch also updates DynamicThreadPoolTaskDispatcher::dispatch to reject any
new Tasks dispatched after DynamicThreadPoolTaskDispatcher::shutdown is called.


Compare: https://github.com/llvm/llvm-project/compare/b0f11dfc7506...831287620567

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