View Single Post
Old 01-31-2024, 10:39 PM   #25
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 47,160
Karma: 169815798
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by Quoth View Post
Unlike MSDE, MS SQL, Oracle, DB2, MySQL, MariaDB the SQLight, just like Access or Excel data, is simply files and an API. So two processes / apps accessing the SQLight database will corrupt it, though with Kobo and USB, normally you are only accessing ebook files and cover image files while USB is connected and the Kobo accesses the database when you disconnect USB. It could even be that it's that process that causes the damage because it hasn't checked what last state was, or the process last using the database didn't close it before locking screen and opening USB connection.
The issue for me is that one or both of the databases are not properly closed. I not only see KoboReader.sqlite and BookReader.sqlite when database corruption is reported but the KoboReader.sqlite-wal and KoboReader.sqlite-shm files and/or the BookReader.sqlite-wal and BookReader.sqlite-shm files. Since the write ahead logging and shared memory files will be removed during the database close operation, this says the database(s) were not properly closed before the USB connection. This also leaves the dirty bit set so Windows pops up the "an error was seen, do you want to scan and fix the drive" message

Quote:
Originally Posted by Quoth View Post
The fact that the database corruption can occur just by copying a single epub file to the Kobo, without touching the database files, shows it's not specifically a USB issue and that it could occur even if the SQLight files were on the system partition that's not shared. The database import occurs after USB is disconnected, so as the exposed files show the issue is not the kind of USB connection but something amiss when the USB connection request is triggered..
Again, calibre pops up the error message when attempting to open the KoboReader.sqlite as part of mounting the Kobo since it will write to the file.

Quote:
Originally Posted by Quoth View Post
I always wait a little before clicking on the connect message when I plug in USB cable. I've no idea if that helps, but I don't have the problem. I also always thought 'auto-connect' sounded like a risky developer tool. Android used to autoconnect and last few versions I have it asks even though a default mode is set.
For what it's worth, I've set the sleep timeout to 15 minutes and telneting to my Kobo Sage shows the -wal and -shm file present after 12 minutes of idle time. So far all I can say is that the issue happens most often on my Sage after I have been reading a book, my Clara HD and others trigger the issue very rarely.
DNSB is offline   Reply With Quote