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

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



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));

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