Skip to content

Commit

Permalink
incusd/instance/qemu/qmp: Don't risk blocking QMP on eject
Browse files Browse the repository at this point in the history
This would lead to occasional QMP dead locks when the instance would be
queried while processing the eject request.

Signed-off-by: Stéphane Graber <[email protected]>
  • Loading branch information
stgraber committed Jan 29, 2024
1 parent 017e426 commit add5702
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions internal/server/instance/drivers/qmp/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,12 @@ func (m *Monitor) start() error {
if e.Event == EventDiskEjected {
id, ok := e.Data["id"].(string)
if ok {
err = m.Eject(id)
if err != nil {
logger.Warnf("Unable to eject media %q: %v", id, err)
}
go func() {
err = m.Eject(id)
if err != nil {
logger.Warnf("Unable to eject media %q: %v", id, err)
}
}()
}
}

Expand Down

0 comments on commit add5702

Please sign in to comment.