Offline sqldb file corrupted?

Atila shared this problem 5 years ago
Not a Problem

I was dowloading tiles for my offline DB and Locus crashed. When I restarted, my sqldb file was not accessible anymore. The is there, I can see it via file manager. Firt, Locus would say to me that I had an I/O error when restarting. I cleared the data cache as instructed in another topic here, and now, Locus starts, sends me no error message, but my file is not shown in "Personal Maps" (nothing is shown there actually).


If I try to download additional tiles, using the "External map (SQL type)" option, it locates the file, but when I select "Start", it simply goes back to the selection dialog "Download map" and nothing happens.


It is a huge file with almost 3 GB, with all the offline maps I have been downloading for months! Help!

Comments (22)

photo
1

After rebooting, I managed to see the error message again. I appears when I start Locus and it tries to load my data. See attached image.


If I try to download to the old file, I get the following error:


photo
1

Hello,


I’m little bit worry ... Anyway in first step:


- Copy sqlitedb file to your PC


- Try to open database with some sqlite browser (eg. Firefox Sqlite manager add-on)


Let me know if you are able to open DB file

photo
1

Did that... It seems to open, but I see nothing in it, though its size is almost 3 GB!


I can see the structure, but the "tiles" table seems to be empty (it says there is only one record, but even this one is invisible...


photo
1

Hi,


Thank you for test. We can try to recovery DB using DB dump.


- Download sqlite shell for your operating system http://www.sqlite.org/download.html


- Steps for DB dump and recovery are detailed described here: http://www.coderelic.com/2012/08/how-...


Please, let me know if it help.

photo
0

No, it is not working...


Can I send to you a dropbox link to the database so that you can see what can be done?

photo
1

Of course you can if you don`t mind to share 3GB. I’ll check but I’m worry if I’ll be successful.

photo
0

Ok, thanks. To what email can I send the link?

photo
1

Please send it on locus@asamm.com

photo
1

Link sent by email, thanks.

photo
0

i tried downloading USGS topo maps for off-line use, but i always ended-up with getting errors writing some of the tiles, and the db appears corrupted.


i did a full-check of my SD card, and it is all good (no IO error when checking the SD card). i only see errors when trying to save maps for off-line use, and no other app has ever done any sort of IO error on my card. so i suspect a Locus bug.


i am using an atrix 2 with stock ICS 4.0.4 from AT&T.

photo
1

Hi Tristan,


can you send me the central point (coordinates/city) and also the zoom-levels range you want to download, please?


Anyway remove all corrupted sqlitedb files (maps) form folder Locus/maps. Try to download smaller part for example 50 tiles in zoom-level 13-14. Please let me know if you get the same error.

photo
1

i was trying to download a section of death valley national park. but i got the same problem when trying to download any section of map.


in fact i got multiple problems.


sometimes the map would not even start to download, and immediately after i start downloading, it sends me back to the dialog where i must select "screen area" etc, after briefly displaying a notification "creating map".


i think this happens when there are corrupted map db`s in /sdcard/Locus/maps and /sdcard/Locus/mapsOnline.


after deleting all the maps in those folders (using ES File Explorer), i was able to start the downloading process.


i will attempt to reproduce the issues with corrupted DB`s, and i`ll post here.

photo
0

here what i observed this time.


1) this the download occurred with no error (i am downloading the USGS tiles over wifi)


2) then Locus displayed a "processing" message for a while.


3) then very briefly, it displayed "problem with the file ..." (didn`t have time to read the file name, but that was probably the db file that i just downloaded.


then, in the MAPS section of locus, the local map that i just downloaded is not showing up. but i can see the db file and the journal file in /sdcard/Locus/maps with the file explorer.


if i reboot the device and restart locus, it loads the local maps. when it reaches the corrupted map, it displays (very briefly) a message:


"problem with /mnt/sdcard/Locus/maps/California saline valley sth.sqlitedb" (that`s the corrupted map)


then it displays:


---------------------------------


Problem with map adding


File /mnt/sdcard/Locus/maps/West Sacramento.sqlitedb


Error: unknow problem


File /mnt/sdcard/Locus/maps/California saline valley sth.sqlitedb


Error: disk I/O error., while compiling PRAGMA journal_mode=TRUNCATE


--------------------------------


notes:


West Sacramento.sqlitedb is another map that i downloaded before, that ended-up not downloading at all (see my previous post: Locus was sending me back to the "select area" dialog immediately after download started. so presumablu the db is empty.


i checked my SD card at least twice for I/O errors, and it came clean (i did the full-check with read/write verification to detect bad memory blocks on the card). and i never saw any problem with other apps using this card. but there is still a remote chance that the card is bad, so i should probably redo the test with another card to see if the same issue happens.

photo
1

i was able to download a large map from USGS with no problem on another SD card. so maybe the problem is somehow related to my card (or some files on the card)


my next step is to reformat my sd card that causes the problem. when i was doing the backup of this sd card, i noticed something really strange (maybe related to the problem?):


in /sdcard/Locus/data/database , i found a strange file that windows refuses to copy, apparently because the file name is syntactically incorrect.


the file is 0-size, and the filename is formed of those characters:


U+0001 character


U+002E FULL STOP character (.)


U+000D character


U+000A character


pretty bizarre that a file like that ended up in the Locus folder! and there seems to be no way to delete that file too, since it is syntactically incorrect.


anyway, i will reformat my sd card (preferably on the android device itself), and re-run the download test on the reformatted card....

photo
1

so far no problem downloading maps on the reformatted card. i have reached my USGS quota, so i`ll do more testing tomorrow. my bet is that some problems on the sd card filesystem may have contributed to those problems.

photo
1

i got something interesting:


i decided to download a detailed map of San Francisco from MapQuest Classic. This involved downloading 20,000 tiles, which takes several hours on Wifi.


At some point around half-way (after about 2 hours and about 10,000 tiles downloaded) , the download stopped with the message "Process unsuccessful", and a message indicating that the database could not be written, and to check the storage and internet connection. there is about 12GB of free storage on the SD card, and my Wifi connection was ok.


So i tried to get a screen-capture of this message, and got a message that the screen-capture could not be saved... then i tried taking a photo, same problem. for some reason, the /sdcard filesystem became spontaneously "read-only" (i could see /sdcard with the file explorer, but not possible to write it.


strange, uh? - i was not doing anything else with the phone, it was just sitting on my desk... for info, this is an Atrix 2 with the stock ICS 4.0.4 upgrade from AT&T.


so i rebooted the phone, and the card was mounted read-write again. i restarted Locus, and of course, the half-downloaded map caused a database error when Locus tried to load it when i opened Locus.


Then i managed to cause the download to "continue downloading" (but apparently it is re-downloading all the 20,292 zoom-18 tiles of this map, including those that it had previously downloaded. so it will take a few hours again, and we`ll see if i manage to get the full map this time.

photo
1

now, after downloading every 400 tiles or so, i get the following:


Process unsuccessful


Error in opening database file


Progress stopped!


and then it continue downloading more tiles.


i don`t know what could cause those errors (Locus does not display any error code). The SD card has plenty of free space. it`s a 16GB card (freshly reformatted on the device).


have you ever seen this? what do you think the problem is? do you think it`s a hardware issue with my SD card? (i did a chkdsk /R on it and it came clean).

photo
0

Hi,


thank you for detailed testing and description!


It really seems that your SD card is broken. So for further investigation we have to split the whole issue on two parts: 1. broken card and 2. Locus issue.


You’ve written that you’ve checked downloading USGS maps with other SD card. Could you try to download MapQuest map on your second SD card, please?


There is also other limitation – the max size of downloaded map is 4gb for Android 4.x. Anyway I don’t think that you reach this limitation with 10000 tiles.


So try to download the map with second sd card a let me know about progress. If you register some error – please, create detailed log for us: https://asammsoftware.zendesk.com/hc/...


PS: what about another (eg. desktop) SD checking tool?

photo
1

yes, i agree, it seems that the problems are with my SD card, not with Locus (although it would be nice to have more detailed error codes indicating the type of error that Locus gets, if those are available from the OS of the database library.


I will try to download the big MapQuest map on my other SD card and i`ll report here (tomorrow, since it will take part of the night).


yes, i know about the 4GB file size limit, but that all the databases for the maps i am downloading are less than 1GB so that should not be the problem.


Do you know any other good tools to test SD cards? (on windows or android)


chkdsk /R (run on windows) does not find any bad sectors on my card, but i don`t know if chkdsk /R can really be trusted to check SD cards with FAT32...

photo
1

Locus was able to download the 20,000 tiles or so map on my other SD card, so yes, this point to an issue with the first SD card i was using, not with Locus.


what is strange is that the SD card causing problems seems to pass all write/read checks (when i test it with windows). i tested it again, this time with h2test ( http://www.heise.de/download/h2test.html - it`s a utility in German), and all the card space passed the write/read test without a single error. so maybe the voltage of the SD card interface on the phone is slightly marginal and causes this SD card to malfunction? it`s the first time i see that!


do you know any SD card checking software that checks for I/O errors and runs on Android?

photo
1

Hi,


unfortunately I can not suggest any outstanding SD card tool. Maybe anybody from community?


Anyway try find out more with these apps: https://play.google.com/store/search?...

photo
1

thanks.


the SD card that works for me is 2GB, the one that had problems was 16GB (branded Samsung put possibly a Chinese copy). i ordered another large card (32GB) from a different source, and i`ll do more test when i receive it.