http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.1_r2/android/database/sqlite/SQLiteDatabase.java

Look for a method called onCorruption.




Nathan <nathan.d.mel...@gmail.com> 20 сентября 2013 г. 2:20:05 написал:


On Thursday, September 19, 2013 12:38:19 PM UTC-7, Kostya Vasilyev wrote:
>
> I also get -- rare and very unpleasant -- support emails with this error, also "database disk image is malformed". > > Sometimes it's one of the databases used internally by WebView (and yet, a crash is a crash). >
> Then there are rare cases when the app's database just disappears. >
> The framework has code to detect corrupted databases and delete them. Most likely it's this code that kicks in. I doubt it was added into the framework just for my app. > > SQLite is supposedly the best tested piece of software ever. However, there was one case when its developer admitted on a mailing list that a particular version, which happened to be included in a particular Android release, could corrupt its in-memory buffer, albeit not disk image (if my memory serves me). So nothing is perfect, all software has bugs, yada yada yada... > > I don't even have a theory on what the root cause is: other SQLite bugs, Android's use of ext4, memory chips going bad... I just look at it as a given. >

My experience matches yours in that some databases just disappear. I would like to look at the frameworks code for doing that if you know where I should look. The unusual part, as I've seen, is that people are seeing data disappear and sometimes reappear, within a database where other data may be intact. It can drive one insane, and I've been able to eliminate user error ( I think) in many cases.
To sum up, I've got at least three issues.
1. Databases disappear and I can't stop them. 2. Some weird file thing could be preventing me from getting to the file (do devices unmount and mount their storage whenever they feel like it?) 3. I could be seeing conflicts in threads. Shouldn't happen if they are all reader , but . .. 4 (Maybe). Databases above 2 Gigabytes cause undefined behavior in SQLite.
In the thread I cited, Diane Hackborn said (two years ago):
"Yeah it's actually very likely the problem. Android for various reasons defines off_t to be 32 bit, so if you want to support > 2GB files you need to use off64_t. That unfortunately makes it easy to have code paths that break like this."

https://groups.google.com/forum/#!searchin/android-developers/Sqlitediskioexception/android-developers/eYNJrIgabxU/e7sKm9QCfN4J

I don't know where in the framework to look for off_t and where it is used for SQLite files. Any pointers would help. I would really like to know for what versions of Android this is a problem, if at all. If this 2 gigabyte thing *isn't a problem*, then I want to hold off on telling my users that it is. Some already find 4 Gigabytes restrictive. Somebody just told me they are using 8 gigabytes safely on seven different devices and sharing them among a group of 200 people. Which means he got around my checks in the code to prevent from going over 4 gigabytes. Maybe he is just getting lucky, because if the 2 gig problem is real, it seems like it would fail rather often.
Nathan



--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to