[LOW] STR #4198: IPP deadlock when last page got lost

Bernd Krumb??ck <[email protected]> Mon, 1 Oct 2012 03:44:06 -0700 (PDT)
Newsgroups gmane.comp.printing.cups.bugs
Message-ID <[email protected]>
DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Once again the vpn connections drive our admins crazy. ;)

The source cups server send a job to the destination cups server. The
"Send-Document" request for the last file never reaches the destination
server. After the timeout the destination server tries to remove the job,
but this is not possible because of active client connections. The ipp
backend on the source server always hold one client connection and wait
for job completion.

I've attached a patch, which should ease the situation.

Link: http://www.cups.org/str.php?L4198
Version: 1.5.4

_______________________________________________
cups-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/cups-bugs
cups-1.5.4-reconnect-wait.patch (text/plain, 1.8 KB)
--- cups/http.c.orig	2012-10-01 11:51:02.000000000 +0200
+++ cups/http.c	2012-10-01 11:58:07.000000000 +0200
@@ -2250,6 +2250,19 @@
 int					/* O - 0 on success, non-zero on failure */
 httpReconnect(http_t *http)		/* I - Connection to server */
 {
+  return httpReconnectWithWait(http, 0);
+}
+
+
+/*
+ * 'httpReconnect()' - Reconnect to a HTTP server.
+ */
+
+int					/* O - 0 on success, non-zero on failure */
+httpReconnectWithWait(
+    http_t *http,			/* I - Connection to server */
+    unsigned int seconds)		/* I - Number of seconds to wait between reconnect */
+{
   http_addrlist_t	*addr;		/* Connected address */
 #ifdef DEBUG
   http_addrlist_t	*current;	/* Current address */
@@ -2305,6 +2318,12 @@
   http->wused           = 0;
 
  /*
+  * Wait...
+  */
+  if (seconds > 0)
+    sleep(seconds);
+
+ /*
   * Connect to the server...
   */
 
--- cups/http.h.orig	2012-10-01 12:02:42.000000000 +0200
+++ cups/http.h	2012-10-01 12:03:07.000000000 +0200
@@ -364,6 +364,7 @@
 extern int		httpPut(http_t *http, const char *uri);
 extern int		httpRead(http_t *http, char *buffer, int length) _CUPS_DEPRECATED;
 extern int		httpReconnect(http_t *http);
+extern int		httpReconnectWithWait(http_t *http, unsigned int seconds);
 extern void		httpSeparate(const char *uri, char *method,
 			             char *username, char *host, int *port,
 				     char *resource) _CUPS_DEPRECATED;
--- backend/ipp.c.orig	2012-10-01 11:59:32.000000000 +0200
+++ backend/ipp.c	2012-10-01 12:00:14.000000000 +0200
@@ -1705,7 +1705,6 @@
       * Do the request...
       */
 
-      httpReconnect(http);
       response   = cupsDoRequest(http, request, resource);
       ipp_status = cupsLastError();
 
@@ -1799,7 +1798,7 @@
       * Wait before polling again...
       */
 
-      sleep(delay);
+      httpReconnectWithWait(http, delay);
 
       delay = _cupsNextDelay(delay, &prev_delay);
     }