SQLite Android Bindings
Ticket Change Details
Not logged in
Overview

Artifact ID: f5aaef6ef9c905dbbf20e2583ec4bcb2491fcd0e
Ticket: 8d03600d81328b53c0505672313bebf61944d3b0
suspected bug introduced in jni/android_database_SQLiteConnection.cpp
User & Date: anonymous 2014-06-11 19:48:52
Changes

  1. Change foundin to "trunk"
  2. Change icomment to:

    Hi,

    We've built and deployed this in an APK successfully, but the JNI code has a memory leak. We are using cursor.moveToNext() with row results of a few hundred and we quickly run into the following crash (because Android detects when more than 500-or so dangling memory references are still being held.

    I suspect the following commit is the culprit, since it specifically references changes to nativeExecuteForCursorWindow(), which is listed in the below stack trace from Android.

    [365586dcaf] Replace nativeExecuteForCursorWindow() with an implementation that builds with the NDK. Seems to work, but is not yet tested. Exception handling is almost certainly still wrong. http://www.sqlite.org/android/info/365586dcafe43f880021b0de52b6a19f02fc6ee1

    Would appreciate any comments you can provide. =)

    E/dalvikvm( 8184): JNI ERROR (app bug): local reference table overflow (max=512) W/dalvikvm( 8184): JNI local reference table (0x6287a000) dump: W/dalvikvm( 8184): Last 10 entries (of 512): W/dalvikvm( 8184): 511: 0x4198db00 java.lang.Class W/dalvikvm( 8184): 510: 0x4243ccb0 java.lang.String "4704-6055f85cb8e... (37 chars) W/dalvikvm( 8184): 509: 0x4243cc30 java.lang.String "4705-4257136a352... (37 chars) W/dalvikvm( 8184): 508: 0x4243cbb0 java.lang.String "4706-10b6c6e3309... (37 chars) W/dalvikvm( 8184): 507: 0x4243cb30 java.lang.String "4707-cf8761aaaa2... (37 chars) W/dalvikvm( 8184): 506: 0x42435568 java.lang.String "4708-0eb255040b3... (37 chars) W/dalvikvm( 8184): 505: 0x424354e8 java.lang.String "4709-5ab35850687... (37 chars) W/dalvikvm( 8184): 504: 0x42435468 java.lang.String "4710-30c02305ef4... (37 chars) W/dalvikvm( 8184): 503: 0x424353e8 java.lang.String "4711-aaeb683b34f... (37 chars) W/dalvikvm( 8184): 502: 0x42435368 java.lang.String "4712-8568ce06955... (37 chars) W/dalvikvm( 8184): Summary: W/dalvikvm( 8184): 3 of java.lang.Class (2 unique instances) W/dalvikvm( 8184): 508 of java.lang.String (508 unique instances) W/dalvikvm( 8184): 1 of android.database.CursorWindow E/dalvikvm( 8184): Failed adding to JNI local ref table (has 512 entries) I/dalvikvm( 8184): "pool-1-thread-1" prio=5 tid=18 RUNNABLE I/dalvikvm( 8184): | group="main" sCount=0 dsCount=0 obj=0x42606278 self=0x5b05c1c8 I/dalvikvm( 8184): | sysTid=8234 nice=0 sched=0/0 cgrp=apps handle=1636460376 I/dalvikvm( 8184): | state=R schedstat=( 0 0 0 ) utm=3605 stm=454 core=1 I/dalvikvm( 8184): at android.database.CursorWindow.nativePutString(Native Method) I/dalvikvm( 8184): at android.database.CursorWindow.putString(CursorWindow.java:625) I/dalvikvm( 8184): at org.sqlite.database.sqlite.SQLiteConnection.nativeExecuteForCursorWindow(Native Method) I/dalvikvm( 8184): at org.sqlite.database.sqlite.SQLiteConnection.executeForCursorWindow(SQLiteConnection.java:861) I/dalvikvm( 8184): at org.sqlite.database.sqlite.SQLiteSession.executeForCursorWindow(SQLiteSession.java:840) I/dalvikvm( 8184): at org.sqlite.database.sqlite.SQLiteQuery.fillWindow(SQLiteQuery.java:66) I/dalvikvm( 8184): at org.sqlite.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:169) I/dalvikvm( 8184): at org.sqlite.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:139) I/dalvikvm( 8184): at android.database.AbstractCursor.moveToPosition(AbstractCursor.java:197) I/dalvikvm( 8184): at android.database.AbstractCursor.moveToNext(AbstractCursor.java:245) I/dalvikvm( 8184): at com.couchbase.lite.android.AndroidSQLiteStorageEngine$SQLiteCursorWrapper.moveToNext(AndroidSQLiteStorageEngine.java:179)

    Thank you!

    - Michael R. Hines

  3. Change login to "anonymous"
  4. Change mimetype to "text/x-fossil-plain"
  5. Change private_contact to "dac3f96332ee59f80a2b5b89bced3710de192e2b"
  6. Change severity to "Critical"
  7. Change status to "Open"
  8. Change title to:

    suspected bug introduced in jni/android_database_SQLiteConnection.cpp

  9. Change type to "Code_Defect"