mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-06 10:32:10 +00:00
linux: Set recv timeout for balloon_host_tube to avoid deadlock
Before this change, crosvm process will be stall when `crosvm balloon_stats` command is called before the first message is received because the logic waits reply from balloon device forever and it blocks the VM going forward. This CL sets recv timeout on balloon_host_tube to unblock the execution in such case. BUG=None TEST=Sent `crosvm ballon_stats <socket>` command right after crosvm started and observed Resource temporarily unavailable error instead of stall. Change-Id: I9e7716fdbd3493846993d0a3f727eed2043df4c3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2909697 Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Hikaru Nishida <hikalium@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org> Reviewed-by: Charles William Dick <cwd@google.com>
This commit is contained in:
parent
e6bf005d26
commit
af3f3bbecd
1 changed files with 4 additions and 0 deletions
|
@ -2513,6 +2513,10 @@ where
|
||||||
control_tubes.push(TaggedControlTube::VmMemory(wayland_host_tube));
|
control_tubes.push(TaggedControlTube::VmMemory(wayland_host_tube));
|
||||||
// Balloon gets a special socket so balloon requests can be forwarded from the main process.
|
// Balloon gets a special socket so balloon requests can be forwarded from the main process.
|
||||||
let (balloon_host_tube, balloon_device_tube) = Tube::pair().map_err(Error::CreateTube)?;
|
let (balloon_host_tube, balloon_device_tube) = Tube::pair().map_err(Error::CreateTube)?;
|
||||||
|
// Set recv timeout to avoid deadlock on sending BalloonControlCommand before guest is ready.
|
||||||
|
balloon_host_tube
|
||||||
|
.set_recv_timeout(Some(Duration::from_millis(100)))
|
||||||
|
.map_err(Error::CreateTube)?;
|
||||||
|
|
||||||
// Create one control socket per disk.
|
// Create one control socket per disk.
|
||||||
let mut disk_device_tubes = Vec::new();
|
let mut disk_device_tubes = Vec::new();
|
||||||
|
|
Loading…
Reference in a new issue