Avoid busy loop in cupsd (bug #1179596).

Resolves: rhbz#1179596
This commit is contained in:
Tim Waugh 2015-03-16 17:20:35 +00:00
parent 9ca423a33b
commit 746dd9cf56
2 changed files with 42 additions and 6 deletions

34
cups-busy-loop.patch Normal file
View File

@ -0,0 +1,34 @@
diff -up cups-2.0.2/scheduler/client.c.busy-loop cups-2.0.2/scheduler/client.c
--- cups-2.0.2/scheduler/client.c.busy-loop 2014-08-28 16:37:22.000000000 +0100
+++ cups-2.0.2/scheduler/client.c 2015-03-16 17:24:32.506232983 +0000
@@ -585,6 +585,17 @@ cupsdReadClient(cupsd_client_t *con) /*
* 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) /*
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);

View File

@ -11,7 +11,7 @@ Summary: CUPS printing system
Name: cups Name: cups
Epoch: 1 Epoch: 1
Version: 2.0.2 Version: 2.0.2
Release: 4%{?dist} Release: 5%{?dist}
License: GPLv2 License: GPLv2
Url: http://www.cups.org/ Url: http://www.cups.org/
Source0: http://www.cups.org/software/%{version}/cups-%{version}-source.tar.bz2 Source0: http://www.cups.org/software/%{version}/cups-%{version}-source.tar.bz2
@ -26,6 +26,7 @@ Source8: macros.cups
Patch1: cups-no-gzip-man.patch Patch1: cups-no-gzip-man.patch
Patch2: cups-system-auth.patch Patch2: cups-system-auth.patch
Patch3: cups-multilib.patch Patch3: cups-multilib.patch
Patch4: cups-busy-loop.patch
Patch5: cups-banners.patch Patch5: cups-banners.patch
Patch6: cups-serverbin-compat.patch Patch6: cups-serverbin-compat.patch
Patch7: cups-no-export-ssllibs.patch Patch7: cups-no-export-ssllibs.patch
@ -189,6 +190,9 @@ Sends IPP requests to the specified URI and tests and/or displays the results.
%patch2 -p1 -b .system-auth %patch2 -p1 -b .system-auth
# Prevent multilib conflict in cups-config script. # Prevent multilib conflict in cups-config script.
%patch3 -p1 -b .multilib %patch3 -p1 -b .multilib
# Avoid busy loop in cupsd when connection is closed after request
# sent (bug #1179596).
%patch4 -p1 -b .busy-loop
# Ignore rpm save/new files in the banners directory. # Ignore rpm save/new files in the banners directory.
%patch5 -p1 -b .banners %patch5 -p1 -b .banners
# Use compatibility fallback path for ServerBin. # Use compatibility fallback path for ServerBin.
@ -296,9 +300,6 @@ export CFLAGS="$RPM_OPT_FLAGS -fstack-protector-all -DLDAP_DEPRECATED=1"
--with-xinetd=no \ --with-xinetd=no \
localedir=%{_datadir}/locale localedir=%{_datadir}/locale
# Avoid epoll for the moment (bug #1179596).
sed -i -e 's,\(define HAVE_EPOLL 1\),undef HAVE_EPOLL,' config.h
# If we got this far, all prerequisite libraries must be here. # If we got this far, all prerequisite libraries must be here.
make %{?_smp_mflags} make %{?_smp_mflags}
@ -608,8 +609,9 @@ rm -f %{cups_serverbin}/backend/smb
%{_mandir}/man5/ipptoolfile.5.gz %{_mandir}/man5/ipptoolfile.5.gz
%changelog %changelog
* Sun Mar 15 2015 Tim Waugh <twaugh@redhat.com> - 1:2.0.2-4 * Mon Mar 16 2015 Tim Waugh <twaugh@redhat.com> - 1:2.0.2-5
- Avoid epoll for the moment (bug #1179596). - Avoid busy loop in cupsd when connection is closed after request
sent (bug #1179596).
* Mon Feb 16 2015 Jiri Popelka <jpopelka@redhat.com> - 1:2.0.2-2 * Mon Feb 16 2015 Jiri Popelka <jpopelka@redhat.com> - 1:2.0.2-2
- Fixed multilib.patch to check for gnutls instead of openssl. - Fixed multilib.patch to check for gnutls instead of openssl.