Hi Michael, sorry for the late reply — this message was unfortunately caught by my mail filter and I just noticed it.
Regarding applying this change to qemu-stable: this patch only uses the existing qio_net_listener_set_client_func_full() helper. Considering this limited dependency and the fact that the change is confined to cleaning up the listener sources earlier to avoid the fd handling race, it should be safe to apply this patch to the qemu-stable series. Thanks for taking a look and for considering it for the stable branches. > On 11/25/25 17:07, Jie Song wrote: > > From: Jie Song <[email protected]> > > > > When starting a dummy QEMU process with virsh version, monitor_init_qmp() > > enables IOThread monitoring of the QMP fd by default. However, a race > > condition exists during the initialization phase: the IOThread only removes > > the main thread's fd watch when it reaches > > qio_net_listener_set_client_func_full(), > > which may be delayed under high system load. > > > > This creates a window between monitor_qmp_setup_handlers_bh() and > > qio_net_listener_set_client_func_full() where both the main thread and > > IOThread are simultaneously monitoring the same fd and processing events. > > This race can cause either the main thread or the IOThread to hang and > > become unresponsive. > > > > Fix this by proactively cleaning up the listener's IO sources in > > monitor_init_qmp() before the IOThread initializes QMP monitoring, > > ensuring exclusive fd ownership and eliminating the race condition. > > I'm picking this up for qemu-stable series (10.0.x, 10.1.x, 10.2.x), > for now. Please let me know if I shouldn't. > > Yes I've seen this change has a breakage potential, too -- let's see > how it works out. > > Thanks, > > /mjt Best regards, Jie Song
