-
Notifications
You must be signed in to change notification settings - Fork 137
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
JSON.parse error if multiple pages are scanned/processed #224
Comments
No, thank you! Comments like this make it worthwhile! Thanks also for raising the issue - I can from the logs that something odd is happening. I'll need time to look into it. |
This is odd. The final request to finish up the scan happens:
That process finishes up, as expected here:
Which is about 1min 42 seconds later. But 42 seconds earlier the browser requested the files:
The file request in the browser should wait until the previous process has finished before requesting files. But it isn't. One thing that makes me suspicious is that the file request is exactly 60 seconds after the scan finish request. Not only that but you see My hypothesis is that the server is terminating its response after a timeout - with no JSON. My guess is that this isn't normally visible because:
This is likely exacerbated because this is running on a slower CPU. Next steps:
|
I have not been able to reproduce this issue. Although I have been able to get some odd behaviour by changing timeouts. Out of interest, would you be prepared to change app.post('/scanner/scan', async (req, res) => {
// Add this line for a 3 minute timeout
req.setTimeout(180000);
logRequest(req);
try { It's not a solution - but it will help debug to see if I'm on the right lines. Update: the only other thought I had was... You're not running this behind a proxy are you? Like nginx? That might cause issues |
Hi Sam, BTW, one thing, is there a way to also modify 'Batch mode' e.g. from 'None' to 'Manual (with prompt)' via config.local.js? |
Not at all - I'm pleased! Don't bother changing any of the code though. Instead, just increase the nginx timeout. See something like: https://ubiq.co/tech-blog/increase-request-timeout-nginx/ |
See #265 |
See #266 |
First of all, thanks a lot for that amazing piece of software. It enabled me to still use my old hp3900 scanner without worrying about drivers and vendor specific UIs. Furthermore, scans just being accessible via a awesome web interface makes it even more brilliant!
Describe the bug
I'm on version v2.11.0 and running on a RaspberryPi (RPi 3 Model B). I've installed scanservjs manually. All worked fine. However, I just experienced that if scanning multiple pages (>20 and more), clicking afterwards on the Finish button, I get an error after a while telling "SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data" - the webpage switches then still to the 'Files' page, but I can't see the converted scan (PDF) within the files. However, it looks like that the Pi is still busy processing, so if I just wait a while, clicking back to the 'Scan' page and back to the 'Files' page, I'm able to see the converted scan (PDF). For me it looks like a 'race condition' between the Pi still processing something and the scanservjs already expecting it to be finished (just a guess).
Settings
{ version: '2.11.0', params: { deviceId: 'hp3900:libusb:001:004', top: 0, left: 28, width: 192, height: 289, resolution: 150, mode: 'Color', source: 'Flatbed' }, filters: [], pipeline: 'PDF (JPG | Medium quality)', batch: 'manual', index: -1 } }
Client:
Server:
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)" NAME="Raspbian GNU/Linux" VERSION_ID="10" VERSION="10 (buster)" VERSION_CODENAME=buster ID=raspbian ID_LIKE=debian HOME_URL="http://www.raspbian.org/" SUPPORT_URL="http://www.raspbian.org/RaspbianForums" BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
Logs
scanservjs.log.installed.txt
The text was updated successfully, but these errors were encountered: