On Thu, Oct 28, 2021, 6:01 AM Kevin Wolf wrote: > Am 27.10.2021 um 19:49 hat John Snow geschrieben: > > This reply is long, sorry. > > And after writing half of a very long reply myself, I noticed that I was > just very confused, so sorry for making you write a long text for no > real reason (well, at least for my first point - for the second one, > your explanation was very helpful, so thanks for that). > > Somehow I ended up completely ignoring the context of the code (it's run > as part of shutdown functions) and instead thought of the general > condition of QMP connections going away anywhere in the code. > > I suppose this could be a relevant concern in an actually asynchronous > client that may read from the socket (and encounter an error if the QEMU > process has already gone away and closed the connection) at any time, > but that's not what machine.py is meant for, at least not for now. > > So I'll just delete what I already wrote. This patch should be fine. > > Kevin > No problem. The cleanup path here is quite complex, so it wasn't clear that there *wasn't* a problem. I'd like to upgrade machine.py to use asyncio more natively for the console socket and qmp layers in the future and help break it apart into smaller pieces that are easier to reason about. You're right, though, if/when this part becomes async then needing more precision on when we mark a vm as defunct will become important. Thanks for looking at it! --js >