-
Notifications
You must be signed in to change notification settings - Fork 469
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
usb backend hangs in cupsBackChannelWrite #1705
Comments
CUPS.org User: twaugh.redhat The attached patch, cups-str1705.patch, fixes the problem for the reporter. It disables the back-channel data reading altogether. |
CUPS.org User: mike Yeah, that's definitely not the patch we want to use as a final fix, though... ;) cupsBackChannelWrite() shouldn't block, so I'll delve into that code to see what's up... |
CUPS.org User: mike Try the attached patch instead - it makes the backchannel pipe non-blocking so that cupsBackChannelWrite() won't block in the middle of a write(). |
CUPS.org User: twaugh.redhat It isn't blocking in write() -- it's getting EAGAIN. But then it goes back round the loop, times out in select() waiting for write-ready (the pipe is full so it's never ready to write) and then falls through and tries to write() again anyway. |
CUPS.org User: mike OK, the attached patch should take care of EAGAIN... |
CUPS.org User: twaugh.redhat Great. There's still the issue of the odd behaviour of this particular printer though. It seems to offer a 187-byte Device ID each time we read from it -- which is presumably once every time around the write loop. So once the pipe buffer does get filled up (the scheduler isn't reading from it), we'll be waiting for 1s every time we try to pass the back-channel data back to the scheduler. That's going to be really slow for writing a large file! I think we need to catch this weird behaviour and turn off back-channel data reading when we see it. Perhaps if we get the same data a few times in a row or something? |
CUPS.org User: mike Yeah, I'm thinking of adding a backchannel option in the URI and advertising the "backchannel=off" option for Canon printers... |
CUPS.org User: mike OK, this last patch adds a check for Canon printers and disables the backchannel read's and select's. |
CUPS.org User: mike Fixed in Subversion repository. |
"cups-str1705.patch": --- cups-1.2.x/backend/usb-unix.c.str1705 2006-05-18 18:12:40.000000000 +0100
|
"str1705.patch": Index: scheduler/job.c--- scheduler/job.c (revision 5538) if (job->current_file == 0)
set_time(job, "time-at-processing");
cupsdOpenPipe(job->back_pipes);
|
"str1705p2.patch": Index: backchannel.c--- backchannel.c (revision 5547)
|
"str1705p3.patch": Index: usb-unix.c--- usb-unix.c (revision 5551)
/*
@@ -238,7 +247,9 @@
|
Version: 1.2.0
CUPS.org User: twaugh.redhat
RH bugzilla bug #192034:
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=192034
describes a busy loop in the 'usb' backend when printing to a Canon iP4000 USB printer. The problem seems to be that the printer always returns an IEEE 1284 Device ID when asked for data, and this seems to fill a buffer (perhaps the pipe buffer -- does cupsd ever read back_pipe?).
The result is that the 'usb' backend gets stuck looping round select() for write-ready in cupsBackChannelWrite().
The text was updated successfully, but these errors were encountered: