Unverified Commit 38333bfd authored by copilot-swe-agent[bot]'s avatar copilot-swe-agent[bot] Committed by GitHub
Browse files

fix: handle exceptions during balloon monitor shutdown to avoid spurious error logs

parent 68ff6cdd
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -718,7 +718,12 @@ class BalloonMonitor:
                self.event_task.cancel()
            if self.qmp:
                logging.getLogger("qemu.qmp").setLevel(logging.WARNING)
                try:
                    await self.qmp.disconnect()
                except (ConnectionError, BrokenPipeError, OSError, StateError):
                    pass
                except Exception as e:
                    log.debug("QMP disconnect during shutdown failed: %s", e)

# ==========================================================
# Main Execution
@@ -802,6 +807,9 @@ if __name__ == "__main__":
    except KeyboardInterrupt:
        log.debug("Monitor stopped by user.")
        sys.exit(0)
    except asyncio.CancelledError:
        log.info("Monitor exiting: cancelled")
        sys.exit(0)
    except ConnectionError as e:
        log.info("Monitor exiting: %s", e)
        sys.exit(0)