Open denilsonsa opened 2 years ago
Django Q documentation says:
You can resubmit a failed task back to the queue using the admins action menu.
So, to retry a failed task:
/admin/django_q/failure/
It would be great to have this added to the Paperless-ng documentation. (Even better if such tasks wouldn't fail in the first place; see my proposed solutions.)
(Sidenote: now I wonder if I should just delete all the old failed tasks from the admin interface. Would that cause any trouble?)
Describe the bug
About 3.5% of the documents fail to be consumed due to
OSError: [Errno 16] Device or resource busy
My system - short version
Paperless-ng 1.5.0, running on docker on Linux arm64, with the consumption directory pointing to a mounted SMB/CIFS share.
My system - long version
I have a shared folder
Scans
, and inside it I have a folderScans/papeless/consume
. The scanner can write the scanned PDFs directly to that folder. That folder is also mounted on the host Linux system running on the Raspberry Pi (through/etc/fstab
with fstypecifs
and optionsnobrl
). All the paperless-related files are insideScans/papeless/*
.Since the consumption directory is a shared network mount, I can't use filesystem notifications. Instead, I have
PAPERLESS_CONSUMER_POLLING=30
set ondocker-compose.env
.To Reproduce
Expected behavior
I expected all documents to be consumed correctly.
If that wasn't possible, I expected some error message at the paperless-ng dashboard. Such error should have a button to "retry" consuming the same document.
Even better, I expected paperless-ng to retry at least a couple of times by its own, without human intervention. (Or at least retry for a certain subset of errors.)
Webserver logs
These are the only two lines regarding the document that failed:
All the other lines are from other documents that were processed just fine.
Django Q - Failed tasks
Educated guess
I assume the scanner takes a few seconds to write the full file to the consumption directory. If paperless-ng is polling the file, it may happen it detects the file before the file has finished writing. But then I know paperless-ng has built-in logic to wait for the file to not have any changes before start processing; that's good, but maybe this logic is a bit flawed. It may happen the file didn't have any change, but was still locked by the scanner because the scanner was still writing to it. So, when the task tries to process the file, it fails due to the resource being busy.
Proposed solutions
Just some ideas worth investigating, in the order of my preference.
mtime
, try to actually open the file and read it.