[sane-devel] simple-scan & SANE_STATUS_DEVICE_BUSY

Olaf Meeuwissen paddy-hack at member.fsf.org
Wed Aug 5 12:45:49 BST 2020


Hi Alexander,

Alexander Pevzner writes:

> Hi everybody,
>
> it can be interesting for many backend developers.
>
> When simple-scan receives SANE_STATUS_DEVICE_BUSY from sane_start(), it
> simply retries in a loop. Without any limit, without any delay, simply
> spins in retry loop as fast, as backend allows.
>
> This is, in theory, very convenient for users, because as soon as device
> becomes ready, scanning resumes automatically.
>
> But it puts device (and backend) under the stress test. And I believe,
> not all devices (and not all backends) will survive.

Quoting from the SANE Standard's documentation for sane_start() [1]

 > SANE_STATUS_DEVICE_BUSY: The device is busy. The operation should be retried later.

 [1]: https://sane-project.gitlab.io/standard/api.html#sane-start

There is nothing on suggested delays, back-offs or retry counts.  I
guess the idea was that API users were well-behaved :-/

Blame simple-scan for not being none of well-behaved, good-neighbourly
and patient.  And file a bug report with the appropriate project ;-)

I don't think backends should not be bending over backwards to prevent
frontends from DOS-ing the device.  Instead, backend developers should
be cluebatting frontend developers (and vice-versa, btw).  They should
not be antagonists.  They should work together to build an eco-system
where both have the best interests of the other in mind.

That said, if a DOS attempt has the possibility of causing physical
damage to a device, that is something backend developers should work
hard to prevent.

Hope this helps,
--
Olaf Meeuwissen, LPIC-2            FSF Associate Member since 2004-01-27
 GnuPG key: F84A2DD9/B3C0 2F47 EA19 64F4 9F13  F43E B8A4 A88A F84A 2DD9
 Support Free Software                        https://my.fsf.org/donate
 Join the Free Software Foundation              https://my.fsf.org/join



More information about the sane-devel mailing list