[PATCH] bhyve: clean up event thread

Roman Bogorodskiy posted 1 patch 1 week, 3 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20260725085251.59201-1-bogorodskiy@gmail.com
src/bhyve/bhyve_domain.c  | 5 +++++
src/bhyve/bhyve_process.c | 2 ++
2 files changed, 7 insertions(+)
[PATCH] bhyve: clean up event thread
Posted by Roman Bogorodskiy 1 week, 3 days ago
Currently, eventThread cleanup is missing. Fix that by calling
virBhyveDomainObjStopWorker() in virBhyveProcessStop()
and un-referring the eventThread in bhyveDomainObjPrivateFree().

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
---
I think it would be nice to get this in before 12.6.0.

 src/bhyve/bhyve_domain.c  | 5 +++++
 src/bhyve/bhyve_process.c | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/src/bhyve/bhyve_domain.c b/src/bhyve/bhyve_domain.c
index d5bb22501c..b6344185b7 100644
--- a/src/bhyve/bhyve_domain.c
+++ b/src/bhyve/bhyve_domain.c
@@ -54,6 +54,11 @@ bhyveDomainObjPrivateFree(void *data)
 
     virDomainPCIAddressSetFree(priv->pciaddrs);
 
+    if (priv->eventThread) {
+        VIR_ERROR(_("Unexpected event thread still active during domain deletion"));
+        g_object_unref(priv->eventThread);
+    }
+
     g_free(priv);
 }
 
diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c
index 636d74afcc..81f00954c2 100644
--- a/src/bhyve/bhyve_process.c
+++ b/src/bhyve/bhyve_process.c
@@ -675,6 +675,8 @@ virBhyveProcessStop(struct _bhyveConn *driver,
     if ((priv != NULL) && (priv->mon != NULL))
          g_clear_pointer(&priv->mon, bhyveMonitorClose);
 
+    virBhyveDomainObjStopWorker(vm);
+
     cmd = virBhyveProcessBuildDestroyCmd(driver, vm->def);
     if (virCommandRun(cmd, NULL) < 0) {
         /* Only failure of the actual destroy command warrants unsuccessful return code,
-- 
2.52.0
Re: [PATCH] bhyve: clean up event thread
Posted by Michal Prívozník via Devel 1 week, 1 day ago
On 7/25/26 10:52, Roman Bogorodskiy wrote:
> Currently, eventThread cleanup is missing. Fix that by calling
> virBhyveDomainObjStopWorker() in virBhyveProcessStop()
> and un-referring the eventThread in bhyveDomainObjPrivateFree().
> 
> Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
> ---
> I think it would be nice to get this in before 12.6.0.
> 
>  src/bhyve/bhyve_domain.c  | 5 +++++
>  src/bhyve/bhyve_process.c | 2 ++
>  2 files changed, 7 insertions(+)
> 

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Michal