Thursday, September 1, 2011

[android-developers] DexFile.loadDex Periodically Hangs on Android 3.2

I am seeing a problem that may be related to this issue (http://
code.google.com/p/android/issues/detail?id=14962), but I am seeing it
without involving multiple threads.

I have an app that dynamically loads code from a jar file using
DexClassLoader. This normally works very well, but when I run it on a
Motorola Xoom running Android 3.2, the load process hangs about one
out of five times. When I debug the process, the top of the call
stack of the hung thread is:

Class Method File Line Native
dalvik.system.DexFile openDexFile DexFile.java -2 true
dalvik.system.DexFile <init> DexFile.java 105 false
dalvik.system.DexFile loadDex DexFile.java 145 false
dalvik.system.DexClassLoader <init> DexClassLoader.java 126 false

I can see in the log that the hang seems to be happening in DexOpt.
When the load completes successfully, I see this in the log:
DEBUG/dalvikvm(13316): DexOpt: --- BEGIN 'plugin.jar' (bootstrap=0)
---
DEBUG/dalvikvm(13434): DexOpt: load 1ms, verify+opt 12ms
DEBUG/dalvikvm(13316): DexOpt: --- END 'plugin.jar' (success) ---

But when that hang happens, I only see the first of those lines. The
problem is very easy to reproduce in my full app, but I have not been
able to get it to happen in my small test harness that just loads the
plugin. Has anybody run into this problem? Any advice?

Thanks,
Matt

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment