Skip to content

Commit

Permalink
[ORC] Shut down dispatcher in ExecutorProcessControl implementations.
Browse files Browse the repository at this point in the history
f341161 added a task dispatcher for async handlers, but didn't add a
TaskDispatcher::shutdown call to SelfExecutorProcessControl or SimpleRemoteEPC.
This patch adds the missing call, which ensures that we don't destroy the
dispatcher while tasks are still running.

This should fix the use-after-free crash seen in
https://lab.llvm.org/buildbot/#/builders/5/builds/13063
  • Loading branch information
lhames committed Oct 12, 2021
1 parent 9939e56 commit 2815ed5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion llvm/lib/ExecutionEngine/Orc/ExecutorProcessControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ void SelfExecutorProcessControl::callWrapperAsync(ExecutorAddr WrapperFnAddr,
SendResult(WrapperFn(ArgBuffer.data(), ArgBuffer.size()));
}

Error SelfExecutorProcessControl::disconnect() { return Error::success(); }
Error SelfExecutorProcessControl::disconnect() {
D->shutdown();
return Error::success();
}

void SelfExecutorProcessControl::writeUInt8sAsync(
ArrayRef<tpctypes::UInt8Write> Ws, WriteResultFn OnWriteComplete) {
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/ExecutionEngine/Orc/SimpleRemoteEPC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ void SimpleRemoteEPC::callWrapperAsync(ExecutorAddr WrapperFnAddr,

Error SimpleRemoteEPC::disconnect() {
T->disconnect();
D->shutdown();
std::unique_lock<std::mutex> Lock(SimpleRemoteEPCMutex);
DisconnectCV.wait(Lock, [this] { return Disconnected; });
return std::move(DisconnectErr);
Expand Down

0 comments on commit 2815ed5

Please sign in to comment.