[ORC] Shut down dispatcher in ExecutorProcessControl implementations.

f341161689 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
This commit is contained in:
Lang Hames 2021-10-12 13:24:54 -07:00
parent 9939e562f7
commit 2815ed57e3
2 changed files with 5 additions and 1 deletions

View File

@ -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) {

View File

@ -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);