diff options
author | Michael R Sweet <michael.r.sweet@gmail.com> | 2018-11-07 11:33:45 -0500 |
---|---|---|
committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2018-11-07 11:33:45 -0500 |
commit | e7e33bf642f301fbe4df09e731ab7f6eeda2c8ee (patch) | |
tree | 7dacacff8e61e39731c36c832928ac0e10344a22 | |
parent | 37665f15b912a076c63497982fe7784b2e18a3dd (diff) | |
download | cups-e7e33bf642f301fbe4df09e731ab7f6eeda2c8ee.tar.gz |
Fix stuck multi-file jobs (Issue #5359, Issue #5413)
-rw-r--r-- | CHANGES.md | 2 | ||||
-rw-r--r-- | backend/socket.c | 12 | ||||
-rw-r--r-- | scheduler/main.c | 7 |
3 files changed, 16 insertions, 5 deletions
diff --git a/CHANGES.md b/CHANGES.md index 617933762..638263cc2 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -19,6 +19,8 @@ Changes in CUPS v2.2.9 - The IPP Everywhere "driver" now properly supports face-up printers (Issue #5345) - Fixed some typos in the label printer drivers (Issue #5350) +- Multi-file jobs could get stuck if the backend failed (Issue #5359, + Issue #5413) - The IPP Everywhere "driver" no longer does local filtering when printing to a shared CUPS printer (Issue #5361) - The lpadmin command now correctly reports IPP errors when configuring an diff --git a/backend/socket.c b/backend/socket.c index daeafe20d..6cfe38167 100644 --- a/backend/socket.c +++ b/backend/socket.c @@ -1,7 +1,7 @@ /* * AppSocket backend for CUPS. * - * Copyright 2007-2016 by Apple Inc. + * Copyright 2007-2018 by Apple Inc. * Copyright 1997-2007 by Easy Software Products, all rights reserved. * * These coded instructions, statements, and computer programs are the @@ -402,8 +402,10 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ lseek(print_fd, 0, SEEK_SET); } - tbytes = backendRunLoop(print_fd, device_fd, snmp_fd, &(addrlist->addr), 1, - 0, backendNetworkSideCB); + if ((bytes = backendRunLoop(print_fd, device_fd, snmp_fd, &(addrlist->addr), 1, 0, backendNetworkSideCB)) < 0) + tbytes = -1; + else + tbytes = bytes; if (print_fd != 0 && tbytes >= 0) _cupsLangPrintFilter(stderr, "INFO", _("Print file sent.")); @@ -411,7 +413,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ fputs("STATE: +cups-waiting-for-job-completed\n", stderr); - if (waiteof) + if (waiteof && tbytes >= 0) { /* * Shutdown the socket and wait for the other end to finish... @@ -448,7 +450,7 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ if (print_fd != 0) close(print_fd); - return (CUPS_BACKEND_OK); + return (tbytes >= 0 ? CUPS_BACKEND_OK : CUPS_BACKEND_FAILED); } diff --git a/scheduler/main.c b/scheduler/main.c index 2f3a0db58..b17051b71 100644 --- a/scheduler/main.c +++ b/scheduler/main.c @@ -1463,9 +1463,16 @@ process_children(void) (!job->filters[i] && WIFEXITED(old_status))) { /* Backend and filter didn't crash */ if (job->filters[i]) + { job->status = status; /* Filter failed */ + } else + { job->status = -status; /* Backend failed */ + + if (job->current_file < job->num_files) + cupsdSetJobState(job, IPP_JOB_ABORTED, CUPSD_JOB_FORCE, "Canceling multi-file job due to backend failure."); + } } if (job->state_value == IPP_JOB_PROCESSING && |