[libvirt] [PATCH 1/4] Add explicit warning messages when failing to serialize to XDR

Daniel P. Berrange berrange at redhat.com
Tue Aug 17 15:16:32 UTC 2010


When libvirtd fails to serialize a message to XDR the client
connection is terminated immediately. To enable this to be
diagnosed, log the message which caused the problem on the
server

* daemon/dispatch.c: Log XDR serialization failures
---
 daemon/dispatch.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/daemon/dispatch.c b/daemon/dispatch.c
index 3028298..d6c2eb1 100644
--- a/daemon/dispatch.c
+++ b/daemon/dispatch.c
@@ -198,6 +198,8 @@ remoteSerializeError(struct qemud_client *client,
     return 0;
 
 xdr_error:
+    VIR_WARN("Failed to serialize remote error '%s' as XDR",
+	     rerr->message ? *rerr->message : "<unknown>");
     xdr_destroy(&xdr);
     VIR_FREE(msg);
 fatal_error:
@@ -602,6 +604,8 @@ xdr_error:
     xdr_free (data->ret_filter, (char*)&ret);
     xdr_destroy (&xdr);
 fatal_error:
+    VIR_WARN("Failed to serialize reply for program '%d' proc '%d' as XDR",
+	     msg->hdr.prog, msg->hdr.proc);
     return -1;
 }
 
@@ -685,5 +689,7 @@ xdr_error:
     xdr_destroy (&xdr);
 fatal_error:
     VIR_FREE(msg);
+    VIR_WARN("Failed to serialize stream data for proc %d as XDR",
+	     stream->procedure);
     return -1;
 }
-- 
1.7.1




More information about the libvir-list mailing list