[Orc] Only unmap shared memory in controller process destructor
authorAnubhab Ghosh <anubhabghosh.me@gmail.com>
Sat, 20 Aug 2022 20:00:15 +0000 (01:30 +0530)
committerAnubhab Ghosh <anubhabghosh.me@gmail.com>
Sun, 21 Aug 2022 11:06:37 +0000 (16:36 +0530)
commit1134d3a03facccd75efc5385ba46918bef94fcb6
tree344d7059db98ad5d80190cd35315d82db49dfa4b
parent5df428eac37fddbe35c1a18d975ea836277708c1
[Orc] Only unmap shared memory in controller process destructor

By the time SharedMemoryMapper destructor is called, the RPC
connection is no longer available causing the release() call to
always fail. Instead at this point only shared memory regions
can be unmapped safely.

Deinitializers are called and mapped memory is released at the
executor side by ExecutorSharedMemoryMapperService::shutdown()
instead. Memory can also be released earlier by calling release()
earlier before RPC connection is closed.

Differential Revision: https://reviews.llvm.org/D132313
llvm/lib/ExecutionEngine/Orc/MemoryMapper.cpp