[libvirt] [PATCH] Fix errno check, prevent spurious errors under heavy load

Peter Feiner peter at gridcentric.ca
Wed Aug 8 20:59:41 UTC 2012


>From man poll(2), poll does not set errno=EAGAIN, however it does set
errno=EINTR. Have libvirt retry on the appropriate errno.

Under heavy load, a program of mine kept getting libvirt errors 'poll on
socket
failed: Interrupted system call'. The signals were SIGCHLD from processes
forked
by threads unrelated to those using libvirt.

diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c
index 2530ffa..f2a6922 100644
--- a/src/rpc/virnetclient.c
+++ b/src/rpc/virnetclient.c
@@ -1374,7 +1374,7 @@ static int virNetClientIOEventLoop(virNetClientPtr
client,

     repoll:
         ret = poll(fds, ARRAY_CARDINALITY(fds), timeout);
-        if (ret < 0 && errno == EAGAIN)
+        if (ret < 0 && errno == EINTR)
             goto repoll;

         ignore_value(pthread_sigmask(SIG_SETMASK, &oldmask, NULL));
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120808/2032bdbd/attachment-0001.htm>


More information about the libvir-list mailing list