如果你分析下面的代碼,你會看到有4個函數被調用多次(pushNextEntityUpdatedRows,pushNextUpdatedRow,pushNextEntityCreatedRows,pushNextCreatedRow),那不是一個BUG,這就是我如何設計我的代碼工作。你應該知道的是,我有一個擴展了SQLiteOpenHelper的類(DataAccess),我只實例化了這個類。每當功能pushNextEntityUpdatedRows和pushNextEntityCreatedRows被調用時,rawQuery在我的DataAccess類實例中執行。我從不關閉連接,只關閉Cursor對象實例。我不知道是什麼造成這個StackOverflowError。我也不知道爲什麼它總是在145次調用後發生。我如何解決它?感謝提前。Android應用程序中的StackOverflowError
堆棧跟蹤告訴我:
java.lang.StackOverflowError
at java.util.WeakHashMap.poll(WeakHashMap.java:550)
at java.util.WeakHashMap.put(WeakHashMap.java:589)
at android.database.sqlite.SQLiteConnectionPool.finishAcquireConnectionLocked(SQLiteConnectionPool.java:980)
at android.database.sqlite.SQLiteConnectionPool.tryAcquirePrimaryConnectionLocked(SQLiteConnectionPool.java:916)
at android.database.sqlite.SQLiteConnectionPool.waitForConnection(SQLiteConnectionPool.java:682)
at android.database.sqlite.SQLiteConnectionPool.acquireConnection(SQLiteConnectionPool.java:400)
at android.database.sqlite.SQLiteSession.acquireConnection(SQLiteSession.java:905)
at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:586)
at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:37)
at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:44)
at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1436)
at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1375)
at mz.co.cloud.dumbo.db.LSH.getAllNewCreatedRows(LSH.java:2072)
at mz.co.cloud.dumbo.syncmechanism.SyncDataAccessImplementation.getAllNewCreatedRows(SyncDataAccessImplementation.java:182)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityCreatedRows(SyncWorker.java:1039)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1355)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityCreatedRows(SyncWorker.java:1046)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1355)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityCreatedRows(SyncWorker.java:1046)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1355)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityCreatedRows(SyncWorker.java:1046)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1355)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityCreatedRows(SyncWorker.java:1046)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1355)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityCreatedRows(SyncWorker.java:1046)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1355)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityCreatedRows(SyncWorker.java:1046)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1355)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityCreatedRows(SyncWorker.java:1046)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1355)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityCreatedRows(SyncWorker.java:1046)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1355)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityCreatedRows(SyncWorker.java:1046)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1355)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityCreatedRows(SyncWorker.java:1046)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1355)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityCreatedRows(SyncWorker.java:1046)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1355)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityCreatedRows(SyncWorker.java:1046)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1355)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityCreatedRows(SyncWorker.java:1046)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1355)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityCreatedRows(SyncWorker.java:1046)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1355)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityCreatedRows(SyncWorker.java:1046)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1355)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityCreatedRows(SyncWorker.java:1046)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1355)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1169)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1154)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityCreatedRows(SyncWorker.java:1046)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextCreatedRow(SyncWorker.java:1355)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityCreatedRows(SyncWorker.java:1046)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityUpdatedRows(SyncWorker.java:714)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextUpdatedRow(SyncWorker.java:1020)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityUpdatedRows(SyncWorker.java:704)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextUpdatedRow(SyncWorker.java:1020)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityUpdatedRows(SyncWorker.java:704)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextUpdatedRow(SyncWorker.java:1020)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityUpdatedRows(SyncWorker.java:704)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextUpdatedRow(SyncWorker.java:1020)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityUpdatedRows(SyncWorker.java:704)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextUpdatedRow(SyncWorker.java:1020)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityUpdatedRows(SyncWorker.java:704)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextUpdatedRow(SyncWorker.java:1020)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityUpdatedRows(SyncWorker.java:704)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextUpdatedRow(SyncWorker.java:1020)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityUpdatedRows(SyncWorker.java:704)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextUpdatedRow(SyncWorker.java:1020)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityUpdatedRows(SyncWorker.java:704)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextUpdatedRow(SyncWorker.java:1020)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityUpdatedRows(SyncWorker.java:704)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextUpdatedRow(SyncWorker.java:1020)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityUpdatedRows(SyncWorker.java:704)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextUpdatedRow(SyncWorker.java:1020)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityUpdatedRows(SyncWorker.java:704)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextUpdatedRow(SyncWorker.java:1020)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityUpdatedRows(SyncWorker.java:704)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextUpdatedRow(SyncWorker.java:1020)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityUpdatedRows(SyncWorker.java:704)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextUpdatedRow(SyncWorker.java:1020)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityUpdatedRows(SyncWorker.java:704)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextUpdatedRow(SyncWorker.java:1020)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityUpdatedRows(SyncWorker.java:704)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextUpdatedRow(SyncWorker.java:1020)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityUpdatedRows(SyncWorker.java:704)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextUpdatedRow(SyncWorker.java:1020)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityUpdatedRows(SyncWorker.java:704)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextUpdatedRow(SyncWorker.java:1020)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityUpdatedRows(SyncWorker.java:704)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextUpdatedRow(SyncWorker.java:1020)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityUpdatedRows(SyncWorker.java:704)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextUpdatedRow(SyncWorker.java:1020)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityUpdatedRows(SyncWorker.java:704)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextUpdatedRow(SyncWorker.java:1020)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityUpdatedRows(SyncWorker.java:704)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextUpdatedRow(SyncWorker.java:1020)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityUpdatedRows(SyncWorker.java:704)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextUpdatedRow(SyncWorker.java:1020)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushNextEntityUpdatedRows(SyncWorker.java:704)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.pushData(SyncWorker.java:678)
at mz.co.cloud.dumbo.syncmechanism.SyncWorker.startWork(SyncWorker.java:197)
at mz.co.cloud.dumbo.syncmechanism.DumboSync$1.onMessage(DumboSync.java:213)
at com.pier.PierClient$1.run(PierClient.java:268)
at com.pier.core.WorkQueue$PoolWorker.run(WorkQueue.java:81)
你在正確的地方問過。 –
簡而言之,當一個函數被一個函數調用時,會引發一個StackOverflowError,該函數被另一個函數調用,該函數被另一個函數調用,並且此模式深入太多級別。最常見的原因是調用函數體內的函數,創建函數調用的無限循環。 –
發佈您的代碼或我們無法幫助您 –