libcups can busy loop #315

Closed
michaelrsweet opened this Issue Oct 3, 2003 · 8 comments

1 participant

@michaelrsweet

Version: 1.1.17
CUPS.org User: twaugh.redhat

http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=97958

The above bug report contains detailed information about this bug, including source level debugging sessions.

In short, libcups can busy-loop inside ipp_read. It isn't clear what circumstances trigger this.

@michaelrsweet

CUPS.org User: mike

It would be interesting to have your user test 1.1.19 or 1.1.20rc2 to see if the problem occurs there, since the current code handles these conditions differently than 1.1.17 did...

@michaelrsweet

CUPS.org User: twaugh.redhat

It'll take a couple of weeks to be sure that 1.1.19 fixes the problem. I'll get back to you.

@michaelrsweet

CUPS.org User: mike

OK, I'm doing 1.1.20rc3 today with the "final" fixes before 1.1.20, so let me know if 1.1.19 and/or 1.1.20rc3 do not correct the customer's problem.

@michaelrsweet

CUPS.org User: twaugh.redhat

Initial reports look good, but it's only been a couple of working days (the problem was always intermittent).

I'm looking through the 1.1.18->1.1.19 patch. Is it the httpWait() stuff that is meant to fix it?

@michaelrsweet

CUPS.org User: mike

Yes, that is what httpWait() (and some other related changes) does...

@michaelrsweet

CUPS.org User: twaugh.redhat

cups-1.1.17-loop.patch seems to be the relevant bit of the 1.1.18->1.1.19 patch. This patch presumes that the STR75 patch has already been applied.

Does it look okay? (It replaces the patch you originally objected to.)

@michaelrsweet

CUPS.org User: mike

Sorry for the delay; yes, the patch looks correct.

@michaelrsweet

"cups-1.1.17-loop.patch":

--- cups-1.1.17/cups/ipp.c.loop 2003-10-14 16:27:00.000000000 +0100
+++ cups-1.1.17/cups/ipp.c 2003-10-14 16:27:45.000000000 +0100
@@ -2011,7 +2011,10 @@

for (tbytes = 0, bytes = 0; tbytes < length; tbytes += bytes, buffer += bytes)
{

  • if (http->used > 0)
  • if (http->state == HTTP_WAITING)
  • break; +
  • if (http->used > 0 && http->data_encoding == HTTP_ENCODE_LENGTH) { /*
    • Do "fast read" from HTTP buffer directly... @@ -2054,8 +2057,24 @@ } } }
  • else if ((bytes = httpRead(http, (char *)buffer, length - tbytes)) < 0)
  • break;
  • else
  • {
  • /*
  • * Wait a maximum of 1 second for data...
  • */ +
  • if (!httpWait(http,1000))
  • {
  • /*
  • * Signal no data...
  • */ +
  • bytes = -1;
  • break;
  • }
  • else if ((bytes = httpRead(http, (char *)buffer, length - tbytes)) < 0)
  • break;
  • }
    }

    /*

@michaelrsweet michaelrsweet added this to the Stable milestone Mar 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment