Shut down RpcServer together with crosvm
It can take a long time (maybe even never?) for Drop to be called on
a dead RpcBinder object. IVirtualMachine objects already rely on stop()
to be called when the client's VirtualMachine object is closed.
As a first step, shut down the vsock RpcServer running
VirtualMachineServer when the VM is killed.
Bug: 269731051
Test: atest MicrodroidTestApp
Change-Id: I6c9ca2f2d2dd424af206826db97e217e7f0ec5a5
diff --git a/virtualizationmanager/src/crosvm.rs b/virtualizationmanager/src/crosvm.rs
index 9db0971..b68a13b 100644
--- a/virtualizationmanager/src/crosvm.rs
+++ b/virtualizationmanager/src/crosvm.rs
@@ -491,6 +491,10 @@
// first, as monitor_vm_exit() takes it as well.
monitor_vm_exit_thread.map(JoinHandle::join);
+ // Now that the VM has been killed, shut down the VirtualMachineService
+ // server to eagerly free up the server threads.
+ self.vm_context.vm_server.shutdown()?;
+
Ok(())
}