Akheon23 / marketlicensing

Automatically exported from code.google.com/p/marketlicensing
Apache License 2.0
0 stars 0 forks source link

Eexception during verifyLicense() callback when Handler thread is dead #9

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
During onDestroy(), we shut down the Handler thread. There is a slight chance 
that the verifyLicense() callback will get invoked between the thread being 
shut down and this occuring.

While harmless, this does cause a stack trace to get printed to the system log. 
We should either silently swallow that error, or if that's not possible, make 
sure the callback never gets invoked.

---------- Forwarded message ----------
From: Pent <tasker@dinglisch.net>
Date: Sat, Jul 31, 2010 at 9:17 AM
Subject: [android-developers] LVL handler on a dead thread
To: Android Developers <android-developers@googlegroups.com>

W/MessageQueue( 2559): Handler{449e0a68} sending message to a Handler
on a dead thread
W/MessageQueue( 2559): java.lang.RuntimeException: Handler{449e0a68}
sending message to a Handler on a dead thread
W/MessageQueue( 2559):  at
android.os.MessageQueue.enqueueMessage(MessageQueue.java:179)
W/MessageQueue( 2559):  at
android.os.Handler.sendMessageAtTime(Handler.java:457)
W/MessageQueue( 2559):  at
android.os.Handler.sendMessageDelayed(Handler.java:430)
W/MessageQueue( 2559):  at android.os.Handler.post(Handler.java:248)
W/MessageQueue( 2559):  at com.android.vending.licensing.LicenseChecker
$ResultListener.verifyLicense(LicenseChecker.java:208)
W/MessageQueue( 2559):  at
com.android.vending.licensing.ILicenseResultListener
$Stub.onTransact(ILicenseResultListener.java:55)
W/MessageQueue( 2559):  at android.os.Binder.execTransact(Binder.java:
288)
W/MessageQueue( 2559):  at dalvik.system.NativeStart.run(Native Method)

Original issue reported on code.google.com by trevorjohns@google.com on 2 Aug 2010 at 8:00

GoogleCodeExporter commented 9 years ago
Just to add: I have never seen it not happen. And since I like to call 
onDestroy as soon as I have an answer from the server it happens a lot.

Pent

Original comment by Lee.Wil...@googlemail.com on 3 Aug 2010 at 7:21

GoogleCodeExporter commented 9 years ago
I think the dead handler logging and this, more serious one go hand-in-hand:

10-18 16:29:34.627: ERROR/ActivityThread(1947): Activity 
com.alanco.ShiftLightsPro.PluginActivity has leaked ServiceConnection 
com.android.vending.licensing.LicenseChecker@40521d50 that was originally bound 
here
10-18 16:29:34.627: ERROR/ActivityThread(1947): 
android.app.ServiceConnectionLeaked: Activity 
com.alanco.ShiftLightsPro.PluginActivity has leaked ServiceConnection 
com.android.vending.licensing.LicenseChecker@40521d50 that was originally bound 
here
10-18 16:29:34.627: ERROR/ActivityThread(1947):     at 
android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:938)
10-18 16:29:34.627: ERROR/ActivityThread(1947):     at 
android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:833)
10-18 16:29:34.627: ERROR/ActivityThread(1947):     at 
android.app.ContextImpl.bindService(ContextImpl.java:872)
10-18 16:29:34.627: ERROR/ActivityThread(1947):     at 
android.content.ContextWrapper.bindService(ContextWrapper.java:347)
10-18 16:29:34.627: ERROR/ActivityThread(1947):     at 
com.android.vending.licensing.LicenseChecker.checkAccess(LicenseChecker.java:143
)

I create the LicenseChecker in my onCreate() and call onDestroy() in my 
activity's onDestroy(). The sequence that leads to this is onCreate() -> 
onPause -> onDestory() - onCreate(). Last onCreate() follows onDestroy() very 
quickly:

10-18 16:34:15.077: DEBUG/Alanco.ShiftLightsPro(1947): onDestroy
10-18 16:34:15.077: DEBUG/Alanco.ShiftLightsPro(1947): licChecker destroyed
10-18 16:34:15.097: DEBUG/Alanco.ShiftLightsPro(1947): sending license check  
<<--- this is called from onCreate()

Original comment by alex.z...@gmail.com on 18 Oct 2011 at 11:37

GoogleCodeExporter commented 9 years ago
"I create the LicenseChecker in my onCreate() and call onDestroy() in my 
activity's onDestroy()."

03.2013

Still the Same thing... using LVL 

Original comment by pocketso...@gmail.com on 13 Mar 2013 at 6:10

GoogleCodeExporter commented 9 years ago
Hi,
i know this thread is a bit old, but i am having the same problem.

Anyway, i am thinking will it work if we call the LicenseChecker onDestroy 
method once the handler processed the response?????

Original comment by moustaph...@gmail.com on 10 Nov 2013 at 2:09