slyfox      15/06/14 10:49:08

  Added:                cups-2.0.2-poll-CPU-loop-STR-4605.patch
  Log:
  Backport busy CPU loop on a poll(), bug #549732 by Joakim Tjernlund and Shiba.
  
  (Portage version: 2.2.20/cvs/Linux x86_64, signed Manifest commit with key 
611FF3AA)

Revision  Changes    Path
1.1                  
net-print/cups/files/cups-2.0.2-poll-CPU-loop-STR-4605.patch

file : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-print/cups/files/cups-2.0.2-poll-CPU-loop-STR-4605.patch?rev=1.1&view=markup
plain: 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-print/cups/files/cups-2.0.2-poll-CPU-loop-STR-4605.patch?rev=1.1&content-type=text/plain

Index: cups-2.0.2-poll-CPU-loop-STR-4605.patch
===================================================================
http://cups.org/str.php?L4605+P-1+S-2+C0+I0+E0+Q100%25
https://bugs.gentoo.org/show_bug.cgi?id=549732

commit bb00c43fccb5aa2dec8e03bd9783e1ee267266a7
Author: msweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Date:   Wed May 6 18:01:04 2015 +0000

    The scheduler could get caught in a busy loop (STR #4605)
    
    
    
    git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@12613 
a1ca3aef-8c08-0410-bb20-df032aa958be

diff --git a/scheduler/client.c b/scheduler/client.c
index c5a9960..50464a5 100644
--- a/scheduler/client.c
+++ b/scheduler/client.c
@@ -585,6 +585,17 @@ cupsdReadClient(cupsd_client_t *con)       /* I - Client 
to read from */
     * connection and we need to shut it down...
     */
 
+    if (!httpGetReady(con->http) && recv(httpGetFd(con->http), buf, 1, 
MSG_PEEK) < 1)
+    {
+     /*
+      * Connection closed...
+      */
+
+      cupsdLogClient(con, CUPSD_LOG_DEBUG, "Closing on EOF.");
+      cupsdCloseClient(con);
+      return;
+    }
+
     cupsdLogClient(con, CUPSD_LOG_DEBUG, "Closing on unexpected HTTP read 
state %s.",
                   httpStateString(httpGetState(con->http)));
     cupsdCloseClient(con);
@@ -1979,12 +1990,6 @@ cupsdReadClient(cupsd_client_t *con)     /* I - Client 
to read from */
 
        if (httpGetState(con->http) == HTTP_STATE_POST_SEND)
        {
-        /*
-         * Don't listen for activity until we decide to do something with 
this...
-         */
-
-          cupsdAddSelect(httpGetFd(con->http), NULL, NULL, con);
-
          if (con->file >= 0)
          {
            fstat(con->file, &filestats);




Reply via email to