You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 10, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Mar 10, 2026. It is now read-only.
New pdftops does not correctly wait for child on cancel #2808
in http://www.cups.org/str.php?L2780 you fixed the EINTR problem I reported, thank you! However, your patch introduced a change in behaviour: when cancelling a job (and thus calling the signal handler, which sets job_canceled=1), the following "pdfwaitpid != pdfpid" matches, since wait() returned -1/EINTR, but due to job_canceled==1, the while loop was broken. This would then always be considered as a failure, i. e. pdftops would exit with 1.
When applying that patch (instead of mine), the test suite now fails on "11 errors instead of expected 9", on the following:
E [21/Apr/2008:16:57:40 +0000] PID 29175 (/tmp/cups-martin/bin/filter/pdftops) stopped with status 1!
E [21/Apr/2008:16:57:40 +0000] PID 29177 (/tmp/cups-martin/bin/filter/pstops) stopped with status 1!
There are two possibilities:
pdftops is actually meant to exit with 1 when a job is cancelled. Then the test cases need to be updated.
pdftops should succeed if a job is cancelled. Then something like the attached patch should help. (NB that I also added 'volatile', just for robustness; gcc seems to be clever enough to not optimize away the lookup in the while loop, though)
That helps to drop the error messages from 11 to 10, I still get
E [21/Apr/2008:17:13:22 +0000] PID 4457 (/tmp/cups-martin/bin/filter/pstops) stopped with status 1!
which I don't get if I unapply your patch in STR #2780 and just apply my proposed patch there. I do see that the idea of your patch is better, but ATM I seem to be too blind to spot the problem...
Ah, with that updated patch it works for me again. Even if we cancel a job, it should still be properly cleaned up by wait()ing on it, instead of turning it into a zombie.
The correct exit code on cancel should be "1", but we shouldn't be logging this as an error since we have asked for the job to be canceled. That is a separate issue I'm fixing now so that we get a clean run of tests.
I've changed the bug summary to reflect the real issue.
OK, not specifically a dupe then but a problem with the cancel of the child - I've updated the summary once again and attached a patch that will do what is required...
Activity
michaelrsweet commentedon Apr 21, 2008
CUPS.org User: martin.pitt.canonical
Ah, with that updated patch it works for me again. Even if we cancel a job, it should still be properly cleaned up by wait()ing on it, instead of turning it into a zombie.
michaelrsweet commentedon Apr 21, 2008
CUPS.org User: mike
The correct exit code on cancel should be "1", but we shouldn't be logging this as an error since we have asked for the job to be canceled. That is a separate issue I'm fixing now so that we get a clean run of tests.
I've changed the bug summary to reflect the real issue.
michaelrsweet commentedon Apr 21, 2008
CUPS.org User: mike
Fixed in Subversion repository.
Oh, and this is a dupe of STR #2806, which I had filed earlier... :)
michaelrsweet commentedon Apr 21, 2008
CUPS.org User: mike
OK, not specifically a dupe then but a problem with the cancel of the child - I've updated the summary once again and attached a patch that will do what is required...
michaelrsweet commentedon Apr 21, 2008
"str2808.patch":
Index: pdftops.c
--- pdftops.c (revision 7480)
+++ pdftops.c (revision 7481)
@@ -327,23 +327,21 @@
* Parent comes here...
*/
while ((pdfwaitpid = wait(&pdfstatus)) < 0 && errno == EINTR)
while ((pdfwaitpid = wait(&pdfstatus)) != pdfpid && errno == EINTR)
{
/*
Wait until we get a valid process ID or the job is canceled...
*/
if (job_canceled)
break;
job_canceled = 0;
}
if (pdfwaitpid != pdfpid)
if (pdfstatus)
{
}
else if (pdfstatus)
{
if (WIFEXITED(pdfstatus))
{
pdfstatus = WEXITSTATUS(pdfstatus);