I am fetching data from the server in a big quantity. I am using Get method to get response and I am able to get the response but the issue is that in between of parsing application is crashing because of some "HeapWorker is wedged" error.
Logcat
12-20 10:02:55.111: ERROR/dalvikvm(277): HeapWorker is wedged: 10194ms spent inside Landroid/database/sqlite/SQLiteCursor;.finalize()V
12-20 10:02:55.111: INFO/dalvikvm(277): DALVIK THREADS:
12-20 10:02:55.111: INFO/dalvikvm(277): "main" prio=5 tid=3 NATIVE
12-20 10:02:55.111: INFO/dalvikvm(277): | group="main" sCount=1 dsCount=0 s=Y obj=0x4001b268 self=0xbd00
12-20 10:02:55.111: INFO/dalvikvm(277): | sysTid=277 nice=0 sched=0/0 cgrp=default handle=-1344001384
12-20 10:02:55.111: INFO/dalvikvm(277): at android.graphics.NinePatch.nativeDraw(Native Method)
12-20 10:02:55.111: INFO/dalvikvm(277): at android.graphics.NinePatch.draw(NinePatch.java:104)
12-20 10:02:55.111: INFO/dalvikvm(277): at android.graphics.drawable.NinePatchDrawable.draw(NinePatchDrawable.java:188)
12-20 10:02:55.121: INFO/dalvikvm(277): at android.view.View.draw(View.java:6520)
12-20 10:02:55.121: INFO/dalvikvm(277): at android.widget.FrameLayout.draw(FrameLayout.java:352)
12-20 10:02:55.121: INFO/dalvikvm(277): at android.view.ViewGroup.drawChild(ViewGroup.java:1531)
12-20 10:02:55.121: INFO/dalvikvm(277): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
12-20 10:02:55.121: INFO/dalvikvm(277): at android.view.ViewGroup.drawChild(ViewGroup.java:1529)
12-20 10:02:55.121: INFO/dalvikvm(277): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
12-20 10:02:55.121: INFO/dalvikvm(277): at android.view.ViewGroup.drawChild(ViewGroup.java:1529)
12-20 10:02:55.121: INFO/dalvikvm(277): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
12-20 10:02:55.121: INFO/dalvikvm(277): at android.view.View.draw(View.java:6538)
12-20 10:02:55.121: INFO/dalvikvm(277): at android.widget.FrameLayout.draw(FrameLayout.java:352)
12-20 10:02:55.121: INFO/dalvikvm(277): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1830)
12-20 10:02:55.121: INFO/dalvikvm(277): at android.view.ViewRoot.draw(ViewRoot.java:1349)
12-20 10:02:55.121: INFO/dalvikvm(277): at android.view.ViewRoot.performTraversals(ViewRoot.java:1114)
12-20 10:02:55.121: INFO/dalvikvm(277): at android.view.ViewRoot.handleMessage(ViewRoot.java:1633)
12-20 10:02:55.132: INFO/dalvikvm(277): at android.os.Handler.dispatchMessage(Handler.java:99)
12-20 10:02:55.132: INFO/dalvikvm(277): at android.os.Looper.loop(Looper.java:123)
12-20 10:02:55.132: INFO/dalvikvm(277): at android.app.ActivityThread.main(ActivityThread.java:4363)
12-20 10:02:55.132: INFO/dalvikvm(277): at java.lang.reflect.Method.invokeNative(Native Method)
12-20 10:02:55.132: INFO/dalvikvm(277): at java.lang.reflect.Method.invoke(Method.java:521)
12-20 10:02:55.132: INFO/dalvikvm(277): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
12-20 10:02:55.132: INFO/dalvikvm(277): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
12-20 10:02:55.132: INFO/dalvikvm(277): at dalvik.system.NativeStart.main(Native Method)
12-20 10:02:55.132: INFO/dalvikvm(277): "AsyncTask #1" prio=5 tid=15 RUNNABLE
12-20 10:02:55.132: INFO/dalvikvm(277): | group="main" sCount=0 dsCount=0 s=N obj=0x44dd0bd0 self=0x125a30
12-20 10:02:55.132: INFO/dalvikvm(277): | sysTid=283 nice=0 sched=0/0 cgrp=default handle=1203016
12-20 10:02:55.132: INFO/dalvikvm(277): at java.io.BufferedWriter.<init>(BufferedWriter.java:~67)
12-20 10:02:55.132: INFO/dalvikvm(277): at uk.co.dodec.ukrcmobileapp.helper.UDFHelper.createHtml(UDFHelper.java:167)
12-20 10:02:55.132: INFO/dalvikvm(277): at uk.co.dodec.ukrcmobileapp.helper.XMLParser.parseUpdates(XMLParser.java:510)
12-20 10:02:55.132: INFO/dalvikvm(277): at uk.co.dodec.ukrcmobileapp.Homepage$getUpdateTask.doInBackground(Homepage.java:170)
12-20 10:02:55.132: INFO/dalvikvm(277): at uk.co.dodec.ukrcmobileapp.Homepage$getUpdateTask.doInBackground(Homepage.java:1)
12-20 10:02:55.132: INFO/dalvikvm(277): at android.os.AsyncTask$2.call(AsyncTask.java:185)
12-20 10:02:55.132: INFO/dalvikvm(277): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
12-20 10:02:55.132: INFO/dalvikvm(277): at java.util.concurrent.FutureTask.run(FutureTask.java:137)
12-20 10:02:55.141: INFO/dalvikvm(277): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
12-20 10:02:55.141: INFO/dalvikvm(277): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
12-20 10:02:55.141: INFO/dalvikvm(277): at java.lang.Thread.run(Thread.java:1096)
12-20 10:02:55.141: INFO/dalvikvm(277): "Binder Thread #2" prio=5 tid=13 NATIVE
12-20 10:02:55.141: INFO/dalvikvm(277): | group="main" sCount=1 dsCount=0 s=N obj=0x44da1c38 self=0x11d3c8
12-20 10:02:55.141: INFO/dalvikvm(277): | sysTid=282 nice=0 sched=0/0 cgrp=default handle=1343552
12-20 10:02:55.141: INFO/dalvikvm(277): at dalvik.system.NativeStart.run(Native Method)
12-20 10:02:55.141: INFO/dalvikvm(277): "Binder Thread #1" prio=5 tid=11 NATIVE
12-20 10:02:55.141: INFO/dalvikvm(277): | group="main" sCount=1 dsCount=0 s=N obj=0x44d9dea8 self=0x14d8d0
12-20 10:02:55.141: INFO/dalvikvm(277): | sysTid=281 nice=0 sched=0/0 cgrp=default handle=1366160
12-20 10:02:55.141: INFO/dalvikvm(277): at dalvik.system.NativeStart.run(Native Method)
12-20 10:02:55.141: INFO/dalvikvm(277): "JDWP" daemon prio=5 tid=9 VMWAIT
12-20 10:02:55.141: INFO/dalvikvm(277): | group="system" sCount=1 dsCount=0 s=N obj=0x44d9b2a0 self=0x145338
12-20 10:02:55.141: INFO/dalvikvm(277): | sysTid=280 nice=0 sched=0/0 cgrp=default handle=1331744
12-20 10:02:55.141: INFO/dalvikvm(277): at dalvik.system.NativeStart.run(Native Method)
12-20 10:02:55.141: INFO/dalvikvm(277): "Signal Catcher" daemon prio=5 tid=7 VMWAIT
12-20 10:02:55.141: INFO/dalvikvm(277): | group="system" sCount=1 dsCount=0 s=N obj=0x44d9b1e8 self=0x145108
12-20 10:02:55.141: INFO/dalvikvm(277): | sysTid=279 nice=0 sched=0/0 cgrp=default handle=1262808
12-20 10:02:55.141: INFO/dalvikvm(277): at dalvik.system.NativeStart.run(Native Method)
12-20 10:02:55.151: INFO/dalvikvm(277): "HeapWorker" daemon prio=5 tid=5 WAIT
12-20 10:02:55.151: INFO/dalvikvm(277): | group="system" sCount=1 dsCount=0 s=N obj=0x4369a188 self=0x1343c0
12-20 10:02:55.151: INFO/dalvikvm(277): | sysTid=278 nice=0 sched=0/0 cgrp=default handle=1208016
12-20 10:02:55.151: INFO/dalvikvm(277): at java.lang.Object.wait(Native Method)
12-20 10:02:55.151: INFO/dalvikvm(277): - waiting on <0x3362f0> (a java.lang.VMThread)
12-20 10:02:55.151: INFO/dalvikvm(277): at java.lang.Thread.parkFor(Thread.java:1535)
12-20 10:02:55.151: INFO/dalvikvm(277): at java.lang.LangAccessImpl.parkFor(LangAccessImpl.java:48)
12-20 10:02:55.151: INFO/dalvikvm(277): at sun.misc.Unsafe.park(Unsafe.java:317)
12-20 10:02:55.151: INFO/dalvikvm(277): at java.util.concurrent.locks.LockSupport.park(LockSupport.java:131)
12-20 10:02:55.151: INFO/dalvikvm(277): at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:790)
12-20 10:02:55.151: INFO/dalvikvm(277): at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:823)
12-20 10:02:55.151: INFO/dalvikvm(277): at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1153)
12-20 10:02:55.151: INFO/dalvikvm(277): at java.util.concurrent.locks.ReentrantLock$FairSync.lock(ReentrantLock.java:200)
12-20 10:02:55.151: INFO/dalvikvm(277): at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:261)
12-20 10:02:55.151: INFO/dalvikvm(277): at android.database.sqlite.SQLiteDatabase.lock(SQLiteDatabase.java:305)
12-20 10:02:55.151: INFO/dalvikvm(277): at android.database.sqlite.SQLiteProgram.close(SQLiteProgram.java:219)
12-20 10:02:55.151: INFO/dalvikvm(277): at android.database.sqlite.SQLiteQuery.close(SQLiteQuery.java:141)
12-20 10:02:55.151: INFO/dalvikvm(277): at android.database.sqlite.SQLiteCursor.close(SQLiteCursor.java:507)
12-20 10:02:55.151: INFO/dalvikvm(277): at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:586)
12-20 10:02:55.151: INFO/dalvikvm(277): at dalvik.system.NativeStart.run(Native Method)
12-20 10:02:55.151: ERROR/dalvikvm(277): VM aborting
12-20 10:02:55.296: INFO/DEBUG(28): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
12-20 10:02:55.296: INFO/DEBUG(28): signal 11 (SIGSEGV), fault addr deadd00d
12-20 10:02:55.296: INFO/DEBUG(28): r0 00000354 r1 afe1331d r2 0000000c r3 deadd00d
12-20 10:02:55.296: INFO/DEBUG(28): r4 00000026 r5 400091e8 r6 ad065714 r7 003fca30
12-20 10:02:55.296: INFO/DEBUG(28): r8 00000344 r9 00000001 10 ad080c00 fp 00000000
12-20 10:02:55.296: INFO/DEBUG(28): ip ad080160 sp 46a32c58 lr afe142dd pc ad035452 cpsr 20000030
12-20 10:02:55.391: INFO/DEBUG(28): #00 pc 00035452 /system/lib/libdvm.so
12-20 10:02:55.391: INFO/DEBUG(28): #01 pc 000440d8 /system/lib/libdvm.so
12-20 10:02:55.391: INFO/DEBUG(28): #02 pc 0001680c /system/lib/libdvm.so
12-20 10:02:55.391: INFO/DEBUG(28): #03 pc 000170c4 /system/lib/libdvm.so
12-20 10:02:55.391: INFO/DEBUG(28): #04 pc 0001724c /system/lib/libdvm.so
12-20 10:02:55.401: INFO/DEBUG(28): #05 pc 00055b52 /system/lib/libdvm.so
12-20 10:02:55.401: INFO/DEBUG(28): #06 pc 00055c80 /system/lib/libdvm.so
12-20 10:02:55.401: INFO/DEBUG(28): #07 pc 00055d80 /system/lib/libdvm.so
12-20 10:02:55.401: INFO/DEBUG(28): #08 pc 0001353c /system/lib/libdvm.so
12-20 10:02:55.411: INFO/DEBUG(28): #09 pc 00019888 /system/lib/libdvm.so
12-20 10:02:55.411: INFO/DEBUG(28): #10 pc 00018d5c /system/lib/libdvm.so
12-20 10:02:55.411: INFO/DEBUG(28): #11 pc 0004d6d0 /system/lib/libdvm.so
12-20 10:02:55.411: INFO/DEBUG(28): #12 pc 0004d702 /system/lib/libdvm.so
12-20 10:02:55.411: INFO/DEBUG(28): #13 pc 00041c78 /system/lib/libdvm.so
12-20 10:02:55.411: INFO/DEBUG(28): #14 pc 00010000 /system/lib/libc.so
12-20 10:02:55.411: INFO/DEBUG(28): #15 pc 0000fad4 /system/lib/libc.so
12-20 10:02:55.411: INFO/DEBUG(28): code around pc:
12-20 10:02:55.411: INFO/DEBUG(28): ad035440 4808ecb6 6b9b5823 d0002b00 4b064798
12-20 10:02:55.411: INFO/DEBUG(28): ad035450 701c2426 ed28f7d9 0004ab1c fffe57c4
12-20 10:02:55.411: INFO/DEBUG(28): ad035460 fffe8c30 00000354 deadd00d b510b40e
12-20 10:02:55.411: INFO/DEBUG(28): code around lr:
12-20 10:02:55.422: INFO/DEBUG(28): afe142cc 220ce008 2b005eab 1c28d003 47889901
12-20 10:02:55.422: INFO/DEBUG(28): afe142dc 35544306 d5f43f01 2c006824 b003d1ee
12-20 10:02:55.422: INFO/DEBUG(28): afe142ec bdf01c30 00024b44 000000b4 1c0fb5f0
12-20 10:02:55.422: INFO/DEBUG(28): stack:
12-20 10:02:55.422: INFO/DEBUG(28): 46a32c18 00000015
12-20 10:02:55.422: INFO/DEBUG(28): 46a32c1c afe1334d /system/lib/libc.so
12-20 10:02:55.422: INFO/DEBUG(28): 46a32c20 afe3902c /system/lib/libc.so
12-20 10:02:55.422: INFO/DEBUG(28): 46a32c24 afe38fd8 /system/lib/libc.so
12-20 10:02:55.422: INFO/DEBUG(28): 46a32c28 00000000
12-20 10:02:55.422: INFO/DEBUG(28): 46a32c2c afe142dd /system/lib/libc.so
12-20 10:02:55.422: INFO/DEBUG(28): 46a32c30 46a32c44
12-20 10:02:55.422: INFO/DEBUG(28): 46a32c34 afe1331d /system/lib/libc.so
12-20 10:02:55.422: INFO/DEBUG(28): 46a32c38 ad065714 /system/lib/libdvm.so
12-20 10:02:55.422: INFO/DEBUG(28): 46a32c3c ad07ff50 /system/lib/libdvm.so
12-20 10:02:55.422: INFO/DEBUG(28): 46a32c40 400091e8 /dev/ashmem/mspace/dalvik-heap/zygote/0 (deleted)
12-20 10:02:55.422: INFO/DEBUG(28): 46a32c44 ad065714 /system/lib/libdvm.so
12-20 10:02:55.431: INFO/DEBUG(28): 46a32c48 003fca30 [heap]
12-20 10:02:55.431: INFO/DEBUG(28): 46a32c4c afe1337f /system/lib/libc.so
12-20 10:02:55.431: INFO/DEBUG(28): 46a32c50 df002777
12-20 10:02:55.431: INFO/DEBUG(28): 46a32c54 e3a070ad
12-20 10:02:55.431: INFO/DEBUG(28): #00 46a32c58 ad06ccd7 /system/lib/libdvm.so
12-20 10:02:55.431: INFO/DEBUG(28): 46a32c5c ad0440dd /system/lib/libdvm.so
12-20 10:02:55.431: INFO/DEBUG(28): #01 46a32c60 000027d2
12-20 10:02:55.431: INFO/DEBUG(28): 46a32c64 00000000
12-20 10:02:55.431: INFO/DEBUG(28): 46a32c68 42a58733 /data/dalvik-cache/system@[email protected]@classes.dex
12-20 10:02:55.431: INFO/DEBUG(28): 46a32c6c 42ad950b /data/dalvik-cache/system@[email protected]@classes.dex
12-20 10:02:55.431: INFO/DEBUG(28): 46a32c70 003fca30 [heap]
12-20 10:02:55.431: INFO/DEBUG(28): 46a32c74 0000011b
12-20 10:02:55.431: INFO/DEBUG(28): 46a32c78 ad080f8c /system/lib/libdvm.so
12-20 10:02:55.431: INFO/DEBUG(28): 46a32c7c afe0f3b0 /system/lib/libc.so
12-20 10:02:55.431: INFO/DEBUG(28): 46a32c80 009b8cc3
12-20 10:02:55.431: INFO/DEBUG(28): 46a32c84 00000000
12-20 10:02:55.431: INFO/DEBUG(28): 46a32c88 00000354
12-20 10:02:55.431: INFO/DEBUG(28): 46a32c8c 400091e8 /dev/ashmem/mspace/dalvik-heap/zygote/0 (deleted)
12-20 10:02:55.431: INFO/DEBUG(28): 46a32c90 ad07ff50 /system/lib/libdvm.so
12-20 10:02:55.431: INFO/DEBUG(28): 46a32c94 00000354
12-20 10:02:55.431: INFO/DEBUG(28): 46a32c98 0000000a
12-20 10:02:55.431: INFO/DEBUG(28): 46a32c9c ad016810 /system/lib/libdvm.so
I found the solution of my issue I am using transaction while parsing the data and inserting data in to database. But in between I am trying to get some values from database. So that hierarchic like below
<transaction>
<Insert>
<select>
<insert>
</transaction>
I am trying to run select query on database, while database is in a transaction. Actually there is a solution here about concurrent transaction
The SQL command "BEGIN TRANSACTION"
(the TRANSACTION
keyword is optional) is used to take SQLite out of autocommit mode. Note that the BEGIN
command does not acquire any locks on the database. After a BEGIN
command, a SHARED
lock will be acquired when the first SELECT statement is executed. A RESERVED lock will be acquired when the first INSERT
, UPDATE, or DELETE
statement is executed. No EXCLUSIVE
lock is acquired until either the memory cache fills up and must be spilled to disk or until the transaction commits. In this way, the system delays blocking read access to the file file until the last possible moment.
I just removed the select query lines from the code while database is in transaction
Edit
Also there is one other solution is that you set locking enable false like
mDb.setLockingEnabled(false);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With