Skip to contentSkip to conversation

Fix for STR #4187 incomplete, missing part attached

Printing-architecture Till Kamppeter 2 participants 4 messages Sep 5, 2013 – Sep 9, 2013

lore
Share & tools
lore
#0 lore raw

Hi,

it seems that if a CUPS client (like the print dialog of LibreOffice) stays connected to CUPS for a long time, the connection can get dropped and the client does not reconnect.

This is handled by the following Ubuntu bug report:

https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/1020048

and also upstream by the following report in the former STR system:

http://www.cups.org/str.php?L4187

The STR was considered fixed by applying a patch, but the reporter of the Ubuntu bug has found out that another patch is needed to complete the fix. See comment #37 in the Ubuntu report:

https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/1020048/comments/37

The current CUPS 1.7.0rc1 has this "else" part but there is still missing that "if" has also to close the connection when the result of the recv() function is zero, meaning EOF, which happens when the server terminates the connection.-

The attached patch adds this missing part.

In comment #44 of the Ubuntu report it is confirmed that this missing piece applied fixes the problem completely:

https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/1020048/comments/44

Can you apply this patch to the final CUPS 1.7.0? Thanks.

Till

cups/request.c +5 -4
@@ -1018,13 +1018,14 @@
       */
 
       char ch;				/* Connection check byte */
+      int n;
 
 #ifdef WIN32
-      if (recv(cg->http->fd, &ch, 1, MSG_PEEK) < 0 &&
-          WSAGetLastError() != WSAEWOULDBLOCK)
+      if ((n = recv(cg->http->fd, &ch, 1, MSG_PEEK) == 0) ||
+          (n < 0 && WSAGetLastError() != WSAEWOULDBLOCK))
 #else
-      if (recv(cg->http->fd, &ch, 1, MSG_PEEK | MSG_DONTWAIT) < 0 &&
-          errno != EWOULDBLOCK)
+      if ((n = recv(cg->http->fd, &ch, 1, MSG_PEEK | MSG_DONTWAIT) == 0) ||
+	  (n < 0 && errno != EWOULDBLOCK))
 #endif /* WIN32 */
       {
        /*
#1 lore raw

Till,

This is already fixed for <rdar://problem/14484313>, which was created in response to the bug below back in July. The 1.6.4 and 1.7.0 releases that are queued up both contain the fix.

(and FWIW, "n" needs to be ssize_t, not int...)

Quoted 30 lines · Till Kamppeter

Hi,

it seems that if a CUPS client (like the print dialog of LibreOffice) stays connected to CUPS for a long time, the connection can get dropped and the client does not reconnect.

This is handled by the following Ubuntu bug report:

https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/1020048

and also upstream by the following report in the former STR system:

http://www.cups.org/str.php?L4187

The STR was considered fixed by applying a patch, but the reporter of the Ubuntu bug has found out that another patch is needed to complete the fix. See comment #37 in the Ubuntu report:

https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/1020048/comments/37

The current CUPS 1.7.0rc1 has this "else" part but there is still missing that "if" has also to close the connection when the result of the recv() function is zero, meaning EOF, which happens when the server terminates the connection.-

The attached patch adds this missing part.

In comment #44 of the Ubuntu report it is confirmed that this missing piece applied fixes the problem completely:

Quoted 7 lines

https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/1020048/comments/44

Can you apply this patch to the final CUPS 1.7.0? Thanks.

Till

<handle-server-terminating-connection.patch>

_________________________________________________________
Michael Sweet, Senior Printing System Engineer, PWG Chair

#2 lore raw
Quoted 5 lines · Michael Sweet

Till,

This is already fixed for <rdar://problem/14484313>, which was created in response to the bug below back in July. The 1.6.4 and 1.7.0 releases that are queued up both contain the fix.

(and FWIW, "n" needs to be ssize_t, not int...)

Thank you very much, Then I know that I can remove the patch when switching to 1.7.0 final.

By the way, when do you plan to put out 1.7.0 and what are the show stoppers still preventing you from putting it out?

Till

#3 lore raw

Till,

Quoted 5 lines · Till Kamppeter
Quoted 4 lines · Michael Sweet

Till,

This is already fixed for <rdar://problem/14484313>, which was created in response to the bug below back in July. The 1.6.4 and 1.7.0 releases that are queued up both contain the fix.

Quoted 7 lines
Quoted 1 line

(and FWIW, "n" needs to be ssize_t, not int...)

Thank you very much, Then I know that I can remove the patch when switching to 1.7.0 final.

By the way, when do you plan to put out 1.7.0 and what are the show stoppers still preventing you from putting it out?

1.7.0 is tied to the release of OS X 10.9 (nothing I can do about that, sorry...) Once 10.9 is out I'll be able to do periodic 1.7.x releases separate from the 10.9.x releases (no more ties for the patch updates...)

(and yes, I did not say when 1.7.0/10.9 is coming out on purpose...)

_________________________________________________________
Michael Sweet, Senior Printing System Engineer, PWG Chair