[PATCH] Unregister event callback if a fatal error occurs during dispatch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If we get an I/O error in the async event callback for an RPC
client, we might not have consumed all pending data off the
wire. This could result in the callback being immediately
invoked again. At which point the same I/O might occur. And
we're invoked again. And again...And again...

Unregistering the async event callback if an error occurs is
a good safety net. The real error will be seen when the next
RPC method is invoked

* src/rpc/virnetclient.c: Unregister event callback on error
---
 src/rpc/virnetclient.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c
index 9fb8fd4..58d4274 100644
--- a/src/rpc/virnetclient.c
+++ b/src/rpc/virnetclient.c
@@ -1124,8 +1124,10 @@ void virNetClientIncomingEvent(virNetSocketPtr sock,
         goto done;
     }
 
-    if (virNetClientIOHandleInput(client) < 0)
-        VIR_DEBUG("Something went wrong during async message processing");
+    if (virNetClientIOHandleInput(client) < 0) {
+        VIR_WARN("Something went wrong during async message processing");
+        virNetSocketRemoveIOCallback(sock);
+    }
 
 done:
     virNetClientUnlock(client);
-- 
1.7.4.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]