-
Notifications
You must be signed in to change notification settings - Fork 568
file handle leak? #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This is the about the simplest repo case i could get the crash, this will die at around 980 iterations of the loop, if you remove the c.moveToNext() line it doesn't crash, seems like something in the cursor is leaking. public class SqlciphertestActivity extends Activity {
} Logcat output will show this I've repo'd this with the v0.4 release on a 2.1 emulator, a 2.2 emulator and a moto droid 2 running 2.2 |
In the latest commits (see the 0.0.5 tag), we now have removed our own implementation of Cursor and CursorWindow, and are instead relying upon the built-in android.database package for those classes. We are trying to remove as much unnecessary forking as possible to avoid issues like this. So, please, run your test suite on the latest update (see downloads for the bin package) and let us know how it goes. |
It looks pretty good on 2.2, the above repo case, and my larger test suite both run to completion and pass, but on 2.1, i'm seeing this crash, on both a 2.1 emulator and a real 2.1 device. (a samsung galaxy s) I/ActivityManager( 53): Displayed activity com.superfell.sqlc/.SqlciphertestActivity: 916 ms (total 916 ms) |
I can get what looks like the same crash using the supplied NoteCipher app on 2.1 |
I'm guessing this is related to the TARGET_PLATFORM := android-8 in jni/Android.mk. |
@superfell The problem you are facing seems similar to mine, check this: |
Retested this with the new build, many of the crashes i was previously seeing are gone (yay!), but am back to the original issue in this bug. Something is leaking, after you've run enough queries (~900) you get an out of memory crash. I/db (26696): k=800 |
Thanks for the testing and note. We did roll back some code in order to make the majority of the implementation work better and properly. We'll be working with Zetetic crew on reproducing this. |
Just to clarify, by new build, you mean: ? |
Yes. |
The Leak appears to be related to info.guardianproject.database.CursorWindow, which has all its own native hooks etc, but also at the same time extends android.database.CursorWindow which is also trying to manage native memory and so on. From what i can tell so far, the i.g.d.CursorWindow cleans up its own native memory ok, but is not calling through to android.database.CursorWindow to do its cleanup. |
I just sent a pull request that has a fix for this. |
Fantastic. Will review tomorrow. Simon Fell [email protected] wrote: I just sent a pull request that has a fix for this. Reply to this email directly or view it on GitHub: |
I've merged your code. Appreciate the contribution. Will do some more extensive testing tomorrow, using this build with our app Gibberbot. |
I have a test suite for my app that does a lot of open/rawQuery/execSQl/close calls on the database, using the standard SQLiteDatabase this test suite runs fine to completion (tested on both 2.1 & 2.2). When i switch to using sqlcipher the test suite gets about 50% through and the stops with a bunch of errors that all seem related to this log line
E/MemoryHeapBase( 1028): error creating ashmem region: Too many open files
E/CursorWindow( 1028): CursorWindow heap allocation failed
I/TestRunner( 1028): ----- begin exception -----
I/TestRunner( 1028):
I/TestRunner( 1028): java.lang.IllegalStateException: Couldn't init cursor window
Are you aware of any file handle leaks, or areas where you may manage file handles differently to the OS supplied SQLiteDatabase ? I'm working on putting together a simple repo case for this.
I've seen this with v0.4 & v0.3 releases.
The text was updated successfully, but these errors were encountered: