manuc66 / node-hp-scan-to

Allow to send scan from device to computer for some HP All-in-One Printers - Scan to computer
https://manuc66.github.io/node-hp-scan-to/
MIT License
163 stars 25 forks source link

Service Crashes on Multiple Page Scan #806

Closed CharlieSquared closed 11 months ago

CharlieSquared commented 11 months ago

The second page of a scan gets the same file name as page one causing an unlink error.

Device: HP Officejet Pro 7740

Command line or Docker :

docker run
  -d
  --name='scan-hp-node'
  --net='bridge'
  -e TZ="America/Chicago"
  -e HOST_OS="Unraid"
  -e HOST_HOSTNAME="Bakery"
  -e HOST_CONTAINERNAME="scan-hp-node"
  -e 'IP'='10.0.10.37'
  -e 'PATTERN'='"scan"_dd-mm-yyyy_hh-MM-ss'
  -e 'PGID'='100'
  -e 'PUID'='99'
  -e 'UMASK'='022'
  -l net.unraid.docker.managed=dockerman
  -l net.unraid.docker.icon='https://i.ibb.co/SshKGrH/Colors-HP-Logo.jpg'
  -v '/tmp/scan_temp':'/scan':'rw'
  --hostname Fileserver 'manuc66/node-hp-scan-to:latest'

Error log

Target folder: /scan
Temp folder: /tmp/scan-to-pcGmccBj
Running iteration: 0 - errorCount: 0
Host destinations fetched: Fileserver
Re-using existing destination: Fileserver - /WalkupScanToComp/WalkupScanToCompDestinations/1cac60a9-5f4e-1f09-8164-040e3cf9f1dc
Using: Fileserver
Waiting scan event for: /WalkupScanToComp/WalkupScanToCompDestinations/1cac60a9-5f4e-1f09-8164-040e3cf9f1dc
Start listening for new ScanEvent
Scan event captured, saving scan #0
Waiting user input: 1/50
Waiting user input: 2/50
Selected shortcut: SavePDF
Scan will be converted to pdf, using /tmp/scan-to-pcGmccBj as temp scan output directory for individual pages
ScanPlexMode is : Simplex
Afd is : Loaded
New job created: http://10.0.10.37:8080/Jobs/JobList/87
Ready to download page job page 1 at: /Scan/Jobs/87/Pages/1
Page downloaded to: /tmp/scan-to-pcGmccBj/scan_29-11-2023_04-01-20.jpg
Ready to download page job page 2 at: /Scan/Jobs/87/Pages/2
Page downloaded to: /tmp/scan-to-pcGmccBj/scan_29-11-2023_04-01-20.jpg
Job state: Completed, totalPages: 2:
Scan of page(s) completed totalPages: 2:
The following page(s) have been rendered inside '/scan/scan_29-11-2023_04-01-20.pdf': 
        - page   1 - 1654x2204
        - page   2 - 1654x2204
node:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[Error: ENOENT: no such file or directory, unlink '/tmp/scan-to-pcGmccBj/scan_29-11-2023_04-01-20.jpg'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'unlink',
  path: '/tmp/scan-to-pcGmccBj/scan_29-11-2023_04-01-20.jpg'
}

Node.js v18.18.2
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped
manuc66 commented 11 months ago

Reproduced, fix ongoing