Control: reassign -1 libcups2 2.2.0-1
Control: severity -1 grave
Control: tags -1 + upstream fixed-upstream patch
Cotroll: forwarded -1 https://github.com/apple/cups/issues/4870

Hello Felipe Ortiz.

Thanks for your bug report.

On Wed, Sep 21, 2016 at 02:22:54AM -0300, Felipe Ortiz wrote:
> Package: gnome-settings-daemon
> Version: 3.21.92.1-1
> Severity: normal
> 
> Dear Maintainer,
> 
> After login gnome-settings-daemon use a 100% of my CPU and other wierd
> behavior like multimedia keys malfunction, screen brightness applet
> doesn't work (work fine with function keys) and in gnome-control-center
> can not access to "power" section. Before login CPU usage is normal and
> multimedia keys work as usual.

We've also noticed this problem and the cause is found in the recent
cups update in unstable. To work around the problem you can either
downgrade to libcups{,image}2_2.1.4-4*deb from testing or install
the cups (daemon). Another alternative is to come along for the ride
of fixing this properly which I'll be discussing below.

The problem is that calls to 'cupsGetDests' will end up spinning in
an endless loop if you don't have the cups daemon running/listening.
This can be observed as reported above with gnome-settings-daemon
taking 100% cpu in a normal gnome session or by starting the
gnome-control-center and clicking Printers which will spin forever
waiting for a reply and eating your cpu (both cases cups daemon
not running to trigger the problem).

The issue is already know and fixed upstream. See the above control
information. I've verified the following commit fixes the problems
I'm seeing:
https://github.com/apple/cups/commit/0ca77b3e89dc1f75c91e1a084dba861e378c6c8d

The commit applies cleanly on top of 2.2.0 if you ignore the CHANGES.txt
part. For your convenience I've attached a debdiff.

(Fwiw, the same issue is also discussed in
https://bugzilla.redhat.com/show_bug.cgi?id=1366775 )

Regards,
Andreas Henriksson
diff --git a/debian/changelog b/debian/changelog
index a77e42b..8cba9ea 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+cups (2.2.0-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Add d/p/0001-Handle-partial-failures-when-connecting-Issue-4866.patch
+    from upstream (Closes: #838434)
+
+ -- Andreas Henriksson <andr...@fatal.se>  Wed, 21 Sep 2016 09:16:33 +0200
+
 cups (2.2.0-1) unstable; urgency=medium
 
   * New 2.2.0 upstream release
diff --git a/debian/patches/0001-Handle-partial-failures-when-connecting-Issue-4866.patch b/debian/patches/0001-Handle-partial-failures-when-connecting-Issue-4866.patch
new file mode 100644
index 0000000..32e1418
--- /dev/null
+++ b/debian/patches/0001-Handle-partial-failures-when-connecting-Issue-4866.patch
@@ -0,0 +1,67 @@
+From 0ca77b3e89dc1f75c91e1a084dba861e378c6c8d Mon Sep 17 00:00:00 2001
+From: Michael Sweet <michael.r.sw...@gmail.com>
+Date: Tue, 20 Sep 2016 15:23:40 -0400
+Subject: [PATCH] Handle partial failures when connecting (Issue #4866)
+
+---
+ CHANGES.txt          |  1 +
+ cups/http-addrlist.c | 26 +++++++++++++++++++++++---
+ 2 files changed, 24 insertions(+), 3 deletions(-)
+
+diff --git a/cups/http-addrlist.c b/cups/http-addrlist.c
+index 6e2ad81..e9ef53e 100644
+--- a/cups/http-addrlist.c
++++ b/cups/http-addrlist.c
+@@ -304,6 +304,8 @@ httpAddrConnect2(
+ 
+     if (result > 0)
+     {
++      http_addrlist_t *connaddr = NULL;	/* Connected address, if any */
++
+       for (i = 0; i < nfds; i ++)
+       {
+ #  ifdef HAVE_POLL
+@@ -314,7 +316,7 @@ httpAddrConnect2(
+ #  endif /* HAVE_POLL */
+ 	{
+ 	  *sock    = fds[i];
+-	  addrlist = addrs[i];
++	  connaddr = addrs[i];
+ 
+ #  ifdef DEBUG
+ 	  len   = sizeof(peer);
+@@ -322,11 +324,29 @@ httpAddrConnect2(
+ 	    DEBUG_printf(("1httpAddrConnect2: Connected to %s:%d...", httpAddrString(&peer, temp, sizeof(temp)), httpAddrPort(&peer)));
+ #  endif /* DEBUG */
+ 	}
+-	else
++#  ifdef HAVE_POLL
++	else if (pfds[i].revents & (POLLERR | POLLHUP))
++#  else
++	else if (FD_ISSET(fds[i], &error))
++#  endif /* HAVE_POLL */
++        {
++         /*
++          * Error on socket, remove from the "pool"...
++          */
++
+ 	  httpAddrClose(NULL, fds[i]);
++          nfds --;
++          if (i < nfds)
++          {
++            memmove(fds + i, fds + i + 1, (size_t)(nfds - i) * (sizeof(fds[0])));
++            memmove(addrs + i, addrs + i + 1, (size_t)(nfds - i) * (sizeof(addrs[0])));
++          }
++          i --;
++        }
+       }
+ 
+-      return (addrlist);
++      if (connaddr)
++        return (connaddr);
+     }
+ #endif /* O_NONBLOCK */
+ 
+-- 
+2.9.3
+
diff --git a/debian/patches/series b/debian/patches/series
index 691f00c..f09532b 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -40,3 +40,4 @@ cups-set-default-error-policy-retry-job.patch
 man-cups-lpd-drop-dangling-references.patch
 debianize_cups-config.patch
 manpage-translations.patch
+0001-Handle-partial-failures-when-connecting-Issue-4866.patch

Reply via email to