Hangup is detected in another thread
Previously, early exit of a VM was not detected immediately by
virtualizationservice because it was waiting for the payload_state to
become Ready until timeout (10 secs) expires.
This change fixes the problem by doing the hangup detection in another
thread. When hangup is detected, the thread updates the payload_state to
Hangup and kills crosvm. That unblocks the main thread which is waiting
for the exit of crosvm.
Bug: 238321974
Test: atest MicrodroidTestApp
Change-Id: I32054f2684edccf22be1433eb003ebb9e0af7598
diff --git a/virtualizationservice/src/aidl.rs b/virtualizationservice/src/aidl.rs
index 0078736..e2e76d5 100644
--- a/virtualizationservice/src/aidl.rs
+++ b/virtualizationservice/src/aidl.rs
@@ -1007,6 +1007,7 @@
PayloadState::Started => VirtualMachineState::STARTED,
PayloadState::Ready => VirtualMachineState::READY,
PayloadState::Finished => VirtualMachineState::FINISHED,
+ PayloadState::Hangup => VirtualMachineState::DEAD,
},
VmState::Dead => VirtualMachineState::DEAD,
VmState::Failed => VirtualMachineState::DEAD,