Skip to content

Conversation

@lhames
Copy link
Contributor

@lhames lhames commented Jan 8, 2025

No description provided.

lhames added 3 commits January 8, 2025 08:09
Ensures cleanup of task dispatcher threads. This may address some of the
nondeterministic failures seen in llvm-jitlink regression tests recently.
Dispatcher shutdown must ensure that any dispatched Tasks have completed *and
been destroyed* prior to returning, so that the ExecutionSession (which Tasks
may access) can be safely destroyed.

DynamicThreadPoolTaskDispatcher::dispatch was holding a unique pointer to the
most recent Task past the point where it notified the shutdown method (via
OutstandingCV) that the thread was done. This could lead to the
ExecutionSession being destroyed before the Task, resulting in use-after-free
style errors (e.g. assertions about dangling SymbolStringPtrs in the
SymbolStringPool destructor).

The solution is just to destroy the Task object immediately after running
it.

This patch also updates the dispatch method to reject any Task dispatched after
the shutdown flag is raised.
@lhames lhames closed this Jan 9, 2025
@lhames lhames deleted the llvm-jitlink-fixes branch January 9, 2025 04:27
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