-
Notifications
You must be signed in to change notification settings - Fork 26
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
"Could not send data, aborting" on second scan #117
Comments
Sorry mistyped the name of the log. |
Thanks for your report. Unfortunately, the log you linked to is not an AirSane log. |
Sorry for the late reply. And also sorry did not check the log I uploaded before. |
Again thank you for your report. It helped me spot an issue with SANE backends that are not thread safe. |
The fix only partially solved the problem. Before, after scanning the first image, my iMac app gets stuck waiting on for the second image, clicking on cancel button does nothing. Now I can cancel and scan again. But still get stuck waiting on the second image scanned. I still see "Could not send data, aborting" in the logs. It seems like there is a problem sending the second image. To be able to scan again and receive the image, I have to restart airsane and my scan app. |
Thanks for the updated log. Could you send me a log without clicking cancel and scanning again? That would be quite helpful. Edit: In the meantime, I added more detailed error logging to airsaned. It would be helpful if you could update to the latest version. |
Mac OS built in Scanner app does not allow scanning again until current scan is completed. So I had to use a different app to be able to do what you want. Mac OS built in app looks like this: Here's the log using NAPS2 Scanning App which allows me to continue requesting for a scan without cancelling. |
Thanks for the log. I really have a hard time to analyze the issue from remote, so I appreciate your patience. When I asked for a log "without clicking and scanning again", I actually meant to say "without doing anything else than clicking "scan" once". Sorry if that was not clear. |
Sorry about that. Here's the log where I only clicked scan once. I went back to using MacOs Builtin Scanner App. |
Now the log looks fine. What happens if you feed the scanner more than one sheet of paper? |
Ok, first of all, my scanner is a portable scanner and is fed manually one sheet at a time. Before you added the worker thread, the scanner will not finish the scanning the second sheet. It stops nearly at the end, leaving the paper stuck in the scanner. And my scanning app also stuck waiting for the image of the second sheet to be sent. After you introduce the worker thread, it would complete the scan of the second page, but my scanning app is still stuck waiting for the image to be sent. Don't know if this would help but if found out that where the "Could not send data, aborting" is comming from. Sorry but my c++ is very very rusty, it's been a long time. And I haven't figured out why it's fails the second time it's flushed to send the image data over to the client. |
You are mostly right except that the ostream is a new one for each HTTP request so the state that makes it fail after the first sheet cannot be located there. Also, for a std::ostream, practically the only way to fail on output is if the associated output file fails in some way (socket in this case). May I ask which architecture your Mac has? On my Intel Mac, when scanning multiple "sheets" from the SANE test backend, I cannot reproduce this issue. In fact, I have never seen the "Could not write data" error before either. I have now added some code to immediately terminate the scanning session when "Could not send data" occurs. This may result in a slightly improved user experience. |
I'm using an intel mac. Airsane is running on a linux container with scanner connected via usb passhtrough. Can you do me a favor and try this, in the hopes that we might replicate the problem? I've discovered that the same issue can be replicated this way. Maybe doing it this way will trigger this bug in your setup. |
Great, thank you! Unfortunately, I don't have a physical ADF scanner, and the SANE test backend works fine for me. |
I did discover an oversight in the basic/fdbuf code, which did not handle the EINTR error condition on read()/write() properly, and could lead to the request's ostream getting "bad". Maybe the issue is fixed now. |
Still the same. Another thing I notice while testing, if I feed a sheet immediately after this first sheet is finished, I see a single pdf file with both image in it in my scan directory, but the second image does not appear in the app screen like the one I posted above. If I switch to jpeg, I see the second image, and see two jpeg files in the directory where the app saves the scan. If I wait until the scanner detects it's out of document to scan, thats when I don't receive the second image. My scanner has no indicator for this I just wait for a few seconds. Here's the basic summary PDF Scanning Scenario:
Jpeg scanning Scneario :
Here's the log. For Scenario 1 PDF. For Scenario 1 JPEG : |
Thanks for your extensive description. I added some error logging to obtain information about why the output stream is broken. |
Installed on Debian 12 running on a virtual machine. Scanning locally using scanimage, no problems even if I do it multiple times.
But when I enable airsane and try to scan remotely on my mac, the first scan works and I receive the image, but if I scan again, my scanner app is stuck waiting for the image.
In the logs I found this message "Could not send data, aborting", but no indicator that it's an error.
attached is captured log running "sudo -u saned airsaned --debug=true --access-log=-"
airsend.log
The text was updated successfully, but these errors were encountered: