Created attachment 405712 [details] Graphic view of reported bug in action Description of problem: gscan2pdf aborts scans at random when scanning multiple pages Version-Release number of selected component (if applicable): gscan2pdf 0.9.30 How reproducible: using a scanner with document feeder for multiple pages scanning. Steps to Reproduce: 1.Place a batch of five or more pages in the scanner document feeder. 2.Start gscan2pdf and request multiple pages scanning. 3.Start scanning. Actual results: It starts scanning normally. Then, after the first page and at random the program stops scanning, forcing user to start scanning again from the first aborted page. Expected results: To keep scanning flawlessly up to the last page. Additional info: I have two brother MFC scanners connected via my home/office network. Using either one shows the same behavior. This time, I started gscan2pdf from the console and placed a 3-pages legal-size document for scan. No problem. Then I tried a 15-pages legal size document. The bug appeared after successful scan of the fourth page. Here is the output from the console: [Francisco@Hogar Desktop]$ gscan2pdf Useless use of sort in void context at /usr/bin/gscan2pdf line 8749. gscan2pdf 0.9.30 Startup LC_NUMERIC C scanimage-perl: rounded value of br-x from 215.9 to 215.88 scanimage-perl: rounded value of br-y from 355.6 to 355.567 scanimage-perl: rounded value of br-x from 215.9 to 215.88 scanimage-perl: rounded value of br-y from 355.6 to 355.567 scanimage-perl: rounded value of br-x from 215.9 to 215.88 scanimage-perl: rounded value of br-y from 355.6 to 355.567 scanimage-perl: rounded value of br-x from 215.9 to 215.88 scanimage-perl: rounded value of br-y from 355.6 to 355.567 scanimage-perl: rounded value of br-x from 215.9 to 215.88 scanimage-perl: rounded value of br-y from 355.6 to 355.567 scanimage-perl: rounded value of br-x from 215.9 to 215.88 scanimage-perl: rounded value of br-y from 355.6 to 355.567 scanimage-perl: rounded value of br-x from 215.9 to 215.88 scanimage-perl: rounded value of br-y from 355.6 to 355.567 *** unhandled exception in callback: *** can't open out5.pnm: No such file or directory at /usr/bin/gscan2pdf line 6654. *** ignoring at /usr/bin/gscan2pdf line 12054. I then started scanning again from the same scanner. This time, it scanned up to the sixth page and stopped again, this time with this additional output: scanimage-perl: rounded value of br-x from 215.9 to 215.88 scanimage-perl: rounded value of br-y from 355.6 to 355.567 *** unhandled exception in callback: *** can't open out6.pnm: No such file or directory at /usr/bin/gscan2pdf line 6654. *** ignoring at /usr/bin/gscan2pdf line 12054. Finally, I tried with the other MFC machine with the same batch of pages and got the same result after just the third page, with this output: [Francisco@Hogar Desktop]$ gscan2pdf Useless use of sort in void context at /usr/bin/gscan2pdf line 8749. gscan2pdf 0.9.30 Startup LC_NUMERIC C scanimage-perl: rounded value of br-x from 215.9 to 215.88 scanimage-perl: rounded value of br-y from 355.6 to 355.567 *** unhandled exception in callback: *** can't open out3.pnm: No such file or directory at /usr/bin/gscan2pdf line 6654. *** ignoring at /usr/bin/gscan2pdf line 12054. Finally, I'm attaching a screenshot of the bug as it happened the first time herein reported. Just let me know if anything else is needed and I'll find the time to do it,
I can verify this bug with an HP 6110 all-in-one. This really makes the program nearly useless for me. I need to be able to scan unattended. This output: *** unhandled exception in callback: *** can't open out6.pnm: No such file or directory at /usr/bin/gscan2pdf line 6654. Seems to appear whenever the thing decides (incorrectly) that the scan job is complete.
I have a little more information. Changed /usr/bin/gscan2pdf to run in debug mode and was able to get the temporary files directory. Here is the error message: *** unhandled exception in callback: *** can't open out3.pnm: No such file or directory at /usr/bin/gscan2pdf line 6654. *** ignoring at /usr/bin/gscan2pdf line 12058. but here is a listing of the temporary directory: $ ls -l total 784 -rw-r--r-- 1 myusername myusername 263713 2010-04-21 17:11 EHnFbcM9ou.pnm -rw-r--r-- 1 myusername myusername 263713 2010-04-21 17:12 out3.pnm -rw-r--r-- 1 myusername myusername 43 2010-04-21 17:10 session -rw-r--r-- 1 myusername myusername 263713 2010-04-21 17:11 VxZwQQuL6d.pnm So the file does exist. The offending line in /usr/bin/gscan2pdf is: open my $fh, '<', $ofilename or die "can't open $ofilename: $!"; So what is going on? Has the scanning process perhaps not release the file yet? I suspected a race condition so I added the following code before line 6654 where the temporary scan file is opened (forgive me if this is a mess -- I have never coded in Perl before) my $trytime = (time + 2); my $foundfile = FALSE; while ( time < $trytime ) { print "Waiting for $ofilename\n" if ($debug); if ( -e $ofilename ) { $foundfile = TRUE; last; } } if ( ! $foundfile) { die "can't wait for $ofilename any longer"; } The output shows section such as: Header suggests 263713 Expecting 263713, found 263713 Importing out15.pnm, format Portable anymap Added /tmp/0GZ2YuDfd3/iitXHEZycs.pnm at page 15 with resolution 150 Scanned page 16. (scanner status = 5) Waiting for out16.pnm Scanning page 17 Format is P4 Header is 33 Header suggests 263713 Expecting 263713, found 263713 Importing out16.pnm, format Portable anymap Added /tmp/0GZ2YuDfd3/tSbXx7Vwpv.pnm at page 16 with resolution 150 Scanned page 17. (scanner status = 5) Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Waiting for out17.pnm Scanning page 18 Format is P4 Header is 33 Header suggests 263713 Expecting 263713, found 263713 Importing out17.pnm, format Portable anymap Added /tmp/0GZ2YuDfd I therefore conclude that I was correct--there is a race condition. I will leave it to better Perl programmers to fix the code properly, but this works for now if anyone else is having this problem.
Created attachment 409558 [details] Fixes race condition when gscan2pdf looks for outN.pnm file before it is provided by scanimage-perl. I have been using the patch and have had no problems with it. Debug output shows that it is frequently "needed" (i.e. gscan2pdf frequently attempts to open outN.pnm before scanimage-perl has created it).
pscottdv, thanks for getting the report upstream. I'd like to wait a bit and get a comment from the author before proceeding on this.
Does this happen with the other frontends - particularly the scanimage frontend?
Created attachment 411472 [details] Non-blocking wait for image Please test this alternative patch, which doesn't wait in a busy loop and therefore doesn't block the GUI.
gscan2pdf-0.9.30-6.fc13 has been submitted as an update for Fedora 13. http://admin.fedoraproject.org/updates/gscan2pdf-0.9.30-6.fc13
gscan2pdf-0.9.30-6.fc12 has been submitted as an update for Fedora 12. http://admin.fedoraproject.org/updates/gscan2pdf-0.9.30-6.fc12
Please test these candidate builds. They have Jeffrey's patch included.
gscan2pdf-0.9.30-6.fc12 has been pushed to the Fedora 12 testing repository. If problems still persist, please make note of it in this bug report. If you want to test the update, you can install it with su -c 'yum --enablerepo=updates-testing update gscan2pdf'. You can provide feedback for this update here: http://admin.fedoraproject.org/updates/gscan2pdf-0.9.30-6.fc12
gscan2pdf-0.9.30-6.fc13 has been pushed to the Fedora 13 testing repository. If problems still persist, please make note of it in this bug report. If you want to test the update, you can install it with su -c 'yum --enablerepo=updates-testing update gscan2pdf'. You can provide feedback for this update here: http://admin.fedoraproject.org/updates/gscan2pdf-0.9.30-6.fc13
Problem seems to be solved, but please refer to my comment for bug 586350.
gscan2pdf-0.9.31-1.fc14 has been submitted as an update for Fedora 14. http://admin.fedoraproject.org/updates/gscan2pdf-0.9.31-1.fc14
gscan2pdf-0.9.31-1.fc13 has been submitted as an update for Fedora 13. http://admin.fedoraproject.org/updates/gscan2pdf-0.9.31-1.fc13
gscan2pdf-0.9.31-1.fc14 has been pushed to the Fedora 14 testing repository. If problems still persist, please make note of it in this bug report. If you want to test the update, you can install it with su -c 'yum --enablerepo=updates-testing update gscan2pdf'. You can provide feedback for this update here: http://admin.fedoraproject.org/updates/gscan2pdf-0.9.31-1.fc14
gscan2pdf-0.9.31-1.fc13 has been pushed to the Fedora 13 testing repository. If problems still persist, please make note of it in this bug report. If you want to test the update, you can install it with su -c 'yum --enablerepo=updates-testing update gscan2pdf'. You can provide feedback for this update here: http://admin.fedoraproject.org/updates/gscan2pdf-0.9.31-1.fc13
gscan2pdf-0.9.31-1.fc14 has been pushed to the Fedora 14 stable repository. If problems still persist, please make note of it in this bug report.
gscan2pdf-0.9.31-1.fc13 has been pushed to the Fedora 13 stable repository. If problems still persist, please make note of it in this bug report.