[SANE] several calls examples/scan.py hangs device forever - I/O Error
I think it is different from #62 because actual results are different. But if you don't agree you may close this issue.
Way to reproduce:
for i in $(seq 10); do echo "\n\n$i\n\n"; python3 scan.py test.png sane:pixma:04A92759_0165900002C6 > stdout_for$i.txt 2> stderr_for$i.txt; sleep 20s; done
Result:
Some calls (in range 1-5) after device reboot are good. The last one call return GLib.Error: libinsane-quark: Libinsane scan_session->read() error: 0x40000006, I/O Error (7)
. Also 5th calls hangs device, after it scanimage
can't scan too:
root@csar:/home/csar/pytho# scanimage -vvvvvv -d pixma:04A92759_0165900002C6 > /dev/null
scanimage: scanning image of size 640x877 pixels at 24 bits/pixel
scanimage: acquiring RGB frame
scanimage: min/max graylevel value = 255/0
scanimage: sane_read: Error during device I/O
Closing device
Calling sane_exit
scanimage: finished
Also unlike of #62 scanimage -L
does not change device id.
Expected result
All calls work well, no error.
Same for with scanimage works well all the times
root@csar:/home/csar/pytho# for i in `seq 10`; do echo "\n\n$i\n\n"; scanimage -vvvvvv -d pixma:04A92759_0165900002C6 > /dev/null; sleep 10s; done
\n\n1\n\n
scanimage: scanning image of size 640x877 pixels at 24 bits/pixel
scanimage: acquiring RGB frame
scanimage: min/max graylevel value = 2/255
scanimage: read 1683840 bytes in total
Closing device
Calling sane_exit
scanimage: finished
\n\n2\n\n
scanimage: scanning image of size 640x877 pixels at 24 bits/pixel
scanimage: acquiring RGB frame
scanimage: min/max graylevel value = 1/255
scanimage: read 1683840 bytes in total
Closing device
Calling sane_exit
scanimage: finished
\n\n3\n\n
scanimage: scanning image of size 640x877 pixels at 24 bits/pixel
scanimage: acquiring RGB frame
scanimage: min/max graylevel value = 2/255
scanimage: read 1683840 bytes in total
Closing device
Calling sane_exit
scanimage: finished
\n\n4\n\n
scanimage: scanning image of size 640x877 pixels at 24 bits/pixel
scanimage: acquiring RGB frame
scanimage: min/max graylevel value = 2/255
scanimage: read 1683840 bytes in total
Closing device
Calling sane_exit
scanimage: finished
\n\n5\n\n
scanimage: scanning image of size 640x877 pixels at 24 bits/pixel
scanimage: acquiring RGB frame
scanimage: min/max graylevel value = 2/255
scanimage: read 1683840 bytes in total
Closing device
Calling sane_exit
scanimage: finished
\n\n6\n\n
scanimage: scanning image of size 640x877 pixels at 24 bits/pixel
scanimage: acquiring RGB frame
scanimage: min/max graylevel value = 2/255
scanimage: read 1683840 bytes in total
Closing device
Calling sane_exit
scanimage: finished
\n\n7\n\n
scanimage: scanning image of size 640x877 pixels at 24 bits/pixel
scanimage: acquiring RGB frame
scanimage: min/max graylevel value = 2/255
scanimage: read 1683840 bytes in total
Closing device
Calling sane_exit
scanimage: finished
\n\n8\n\n
scanimage: scanning image of size 640x877 pixels at 24 bits/pixel
scanimage: acquiring RGB frame
scanimage: min/max graylevel value = 2/255
scanimage: read 1683840 bytes in total
Closing device
Calling sane_exit
scanimage: finished
\n\n9\n\n
scanimage: scanning image of size 640x877 pixels at 24 bits/pixel
scanimage: acquiring RGB frame
scanimage: min/max graylevel value = 1/255
scanimage: read 1683840 bytes in total
Closing device
Calling sane_exit
scanimage: finished
\n\n10\n\n
scanimage: scanning image of size 640x877 pixels at 24 bits/pixel
scanimage: acquiring RGB frame
scanimage: min/max graylevel value = 2/255
scanimage: read 1683840 bytes in total
Closing device
Calling sane_exit
Logs:
- Workings calls have empty stderr.
- stdout_for_working_call.zip
- stdout_for_broken_last_call.zip
- stderr for broken last call:
Traceback (most recent call last):
File "scan.py", line 246, in <module>
main()
File "scan.py", line 239, in main
scan(source, output_file)
File "scan.py", line 148, in scan
data = session.read_bytes(128 * 1024)
GLib.Error: libinsane-quark: Libinsane scan_session->read() error: 0x40000006, I/O Error (7)
Environment:
OS: Ubuntu 16.04.6 LTS
libinsane: 1.0.3-21-g34612d4
Device: Canon i-SENSYS MF3010
libsane/xenial-updates,now 1.0.25+git20150528-1ubuntu2.16.04.1 amd64
libsane-common/xenial-updates,xenial-updates,now 1.0.25+git20150528-1ubuntu2.16.04.1 all
libsane-hpaio/xenial,now 3.16.3+repack0-1 amd64
sane-utils/xenial-updates,now 1.0.25+git20150528-1ubuntu2.16.04.1 amd64