WebView killing the whole activity — How can I debug this?

安稳与你 提交于 2019-12-12 17:07:30

问题


I have a strange problem that I don't know how to face.

My application uses a WebView to load a HTML app. It is a long and complex app, that also involves JavaScriptInterfaces.

Lately I am getting Core Dumps in the native webcore module that kill the whole activity.

It happens sometimes, but frequently, let's say 1 of every 5 times.

It always happens while WebView is loading the app, but on different places. It looks like a call to an exported Java function is involved, but not a specific one. I've refactored a zillion times everything and, while sometimes it seems resolved, it's just a matter of luck. Suddenly it fails again.

If WebView finishes loading and initing the app, it NEVER crashes. It only happens during load/init/start execution.

The only pattern that nearly always appears is, it looks like it always crashes in the same place:

    I/DEBUG   (30186):          #00  pc 003a37a4  /system/lib/libwebcore.so (_ZNK5Layer8getChildEi)
    I/DEBUG   (30186):          #01  pc 00285bae  /system/lib/libwebcore.so
    I/DEBUG   (30186):          #02  pc 0001edb0  /system/lib/libdvm.so (dvmPlatformInvoke)
    I/DEBUG   (30186):          #03  pc 000594ba  /system/lib/libdvm.so (_Z16dvmCallJNIMethodPKjP6JValuePK6MethodP6Thread)

Of course, I know this is an incomplete question, I'll post anything on request, but I'd like to answer if somebody has an idea on how can I guess what's more or less going on, I mean, can I look somewhere with this stack trace?? I am completely lost when it comes to the Android Native Layer.

If only I knew any relation to the crash I could refactor Java or JavaScript, but I'm completely blind, and as much as I have moved everything nothing seems to improve....

Thanks in advance !!!

PD- I am on ICS v.4.04 with a Samsung Galaxy Tab 10.1

    /libc    (  575): Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1)
    I/DEBUG   (30186): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    I/DEBUG   (30186): Build fingerprint: 'samsung/GT-P7500/GT-P7500:4.0.4/IMM76D/XXLQ8:user/release-keys'
    I/DEBUG   (30186): pid: 575, tid: 591  >>> com.regaliz.libneo <<<
    I/DEBUG   (30186): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
    I/DEBUG   (30186):  r0 0117f608  r1 00000000  r2 00feb880  r3 00000000
    I/DEBUG   (30186):  r4 00feb880  r5 00ffb568  r6 00000007  r7 50fbfe0c
    I/DEBUG   (30186):  r8 5bf04c10  r9 50fbfe04  10 00000000  fp 5bf04c24
    I/DEBUG   (30186):  ip 5a229ba5  sp 5bf04c08  lr 5a229bb3  pc 5a3477a4  cpsr 800f3430
    I/DEBUG   (30186):  d0  0000000042c80000  d1  0000000043ae0000
    I/DEBUG   (30186):  d2  3f00000043ae0000  d3  43ae000041c80000
    I/DEBUG   (30186):  d4  00000000432e0000  d5  411efaf800000000
    I/DEBUG   (30186):  d6  3fe03e1c9b413986  d7  41d4634c06a07c39
    I/DEBUG   (30186):  d8  0000000000000000  d9  0000000000000000
    I/DEBUG   (30186):  d10 0000000000000000  d11 0000000000000000
    I/DEBUG   (30186):  d12 0000000000000000  d13 0000000000000000
    I/DEBUG   (30186):  d14 0000000000000000  d15 0000000000000000
    I/DEBUG   (30186):  scr 20000011
    I/DEBUG   (30186):
    I/DEBUG   (30186):          #00  pc 003a37a4  /system/lib/libwebcore.so (_ZNK5Layer8getChildEi)
    I/DEBUG   (30186):          #01  pc 00285bae  /system/lib/libwebcore.so
    I/DEBUG   (30186):          #02  pc 0001edb0  /system/lib/libdvm.so (dvmPlatformInvoke)
    I/DEBUG   (30186):          #03  pc 000594ba  /system/lib/libdvm.so (_Z16dvmCallJNIMethodPKjP6JValuePK6MethodP6Thread)
    I/DEBUG   (30186):          #04  pc 00030c0c  /system/lib/libdvm.so
    I/DEBUG   (30186):          #05  pc 000343e4  /system/lib/libdvm.so (_Z12dvmInterpretP6ThreadPK6MethodP6JValue)
    I/DEBUG   (30186):          #06  pc 0006ce76  /system/lib/libdvm.so (_Z14dvmCallMethodVP6ThreadPK6MethodP6ObjectbP6JValueSt9__va_list)
    I/DEBUG   (30186):          #07  pc 0006ce98  /system/lib/libdvm.so (_Z13dvmCallMethodP6ThreadPK6MethodP6ObjectP6JValuez)
    I/DEBUG   (30186):          #08  pc 0005ffe0  /system/lib/libdvm.so
    I/DEBUG   (30186):          #09  pc 00013048  /system/lib/libc.so (__thread_entry)
    I/DEBUG   (30186):          #10  pc 00012b74  /system/lib/libc.so (pthread_create)
    I/DEBUG   (30186):
    I/DEBUG   (30186): code around pc:
    I/DEBUG   (30186): 5a347784 47a868e1 f57f69a0 4620e95c bf00bd7c  .h.G.i..\. F|...
    I/DEBUG   (30186): 5a347794 0036eb46 3088f8d0 bf3a4299 3080f8d0  F.6....0.B:....0
    I/DEBUG   (30186): 5a3477a4 0021f853 47702000 e005b911 d0034288  S.!.. pG.....B..
    I/DEBUG   (30186): 5a3477b4 280068c0 e000d1fa 47702001 41f0e92d  .h.(..... pG-..A
    I/DEBUG   (30186): 5a3477c4 f8c54605 460e10a0 f5d62400 4607fa1b  .F.....F.$.....F
    I/DEBUG   (30186):
    I/DEBUG   (30186): code around lr:
    I/DEBUG   (30186): 5a229b90 b9084603 e0042001 f8d34620 f6a611a4  .F... .. F......
    I/DEBUG   (30186): 5a229ba0 bd10fd01 4614b510 2100b14b f11d4618  .......FK..!.F..
    I/DEBUG   (30186): 5a229bb0 4601fdf3 4620b118 ffe2f7ff 2001e000  ...F.. F.......
    I/DEBUG   (30186): 5a229bc0 bf00bd10 4ff0e92d 6d464607 460cb0a7  ....-..O.FFm...F
    I/DEBUG   (30186): 5a229bd0 0b90f10d 0a88f10d 52f4f8d6 f6fa4628  ...........R(F..
    I/DEBUG   (30186):
    I/DEBUG   (30186): stack:
    I/DEBUG   (30186):     5bf04bc8  5bf04c24
    I/DEBUG   (30186):     5bf04bcc  400828c0  /system/lib/libc.so
    I/DEBUG   (30186):     5bf04bd0  56d045f8  /dev/ashmem/dalvik-LinearAlloc (deleted)
    I/DEBUG   (30186):     5bf04bd4  00ffb568  [heap]
    I/DEBUG   (30186):     5bf04bd8  00000003
    I/DEBUG   (30186):     5bf04bdc  50fbff00
    I/DEBUG   (30186):     5bf04be0  5bf04c10
    I/DEBUG   (30186):     5bf04be4  400827f0  /system/lib/libc.so
    I/DEBUG   (30186):     5bf04be8  5bf04bf0
    I/DEBUG   (30186):     5bf04bec  40129393  /system/lib/libutils.so
    I/DEBUG   (30186):     5bf04bf0  000607dd
    I/DEBUG   (30186):     5bf04bf4  00000000
    I/DEBUG   (30186):     5bf04bf8  40eb4a68  /dev/ashmem/dalvik-heap (deleted)
    I/DEBUG   (30186):     5bf04bfc  40eb4a68  /dev/ashmem/dalvik-heap (deleted)
    I/DEBUG   (30186):     5bf04c00  df0027ad
    I/DEBUG   (30186):     5bf04c04  00000000
    I/DEBUG   (30186): #01 5bf04c08  56e6d840  /dev/ashmem/dalvik-LinearAlloc (deleted)
    I/DEBUG   (30186):     5bf04c0c  40822db4  /system/lib/libdvm.so
    D/PlasmaWebView[1](  575): Invalidate triggered
    I/BootReceiver( 7248): Copying /data/tombstones/tombstone_05 to DropBox (SYSTEM_TOMBSTONE)
    I/DEBUG   (30186): debuggerd committing suicide to free the zombie!
    I/WindowManager( 7248): WIN DEATH: Window{415980d8 com.regaliz.libneo/com.regaliz.libneo.NativeStory paused=false}
    I/ActivityManager( 7248): Process com.regaliz.libneo (pid 575) has died.
    W/WindowManager( 7248): Force-removing child win Window{416c4f88 SurfaceView paused=false} from container Window{415980d8 com.regaliz.libneo/com.regaliz.libneo.NativeStory paused=false}
    I/flint   (28979): jni: deleting text normalizer ...
    I/flint   (28979): jni: deleting synthesizer ...
    I/flint   (28979): jni: deleting project file ...
    I/flint   (28979): jni: deleting project resource holder ...
    I/DEBUG   (  631): debuggerd: Oct  7 2012 16:35:04
    D/Zygote  ( 7206): Process 575 terminated by signal (11)
    W/ActivityManager( 7248): Force removing ActivityRecord{41303a20 com.regaliz.libneo/.NativeStory}: app died, no saved state

Edit: looks like i have hit a critical bug of webkit: https://bugs.webkit.org/show_bug.cgi?id=93447 . Unfortunately its marked as WONTFIX because Google is moving away from webkit into the new rendering engine Blink... im scared :(

Edit 2: This is already reported on Android Bug Tool with 9 stars, but nobody seems to know why it happens :( https://code.google.com/p/android/issues/detail?id=24232

Edit 3: Too early to open champagne, but it looks like WebView doesn't like to be initialized with a heavy page load when inside a ViewSwitcher and the active View is not him(her/it)self ...


回答1:


It's a little temerary to say, because other times the error appeared sooner or later, but after 5 days of intensive debugging I'm pretty sure I have found the recipe for disaster. I can conclude:

Putting a WebView inside a ViewFlipper, and loading a complex page in it, while showing another ViewFlipper page (in my case a simple throbber) would kill the Activity triggering the core dump

I still keep the WebView in the ViewFlipper, but as long as during Init (page load, page parse, body.onload) its viewflipper page is shown, I have no problems. As soon as I retry the throbber thing ... bang!

After the page is inited, and webview has stabilized, I can successfully change the ViewFlipper views.




回答2:


A few modes of DEBUGing

Have you Asynced Yet?

Are you running the content in a seperate thread?

Can you reproduce this on another device/emulator?

This might be due to unsupported/changed libwebcore or other file versions.

Try the JS on a Desktop Browser?

If the javascript runs fine on a Standard Browser we have a degree of confidence. You can take this a level further and use Desktop tools to poke and analyze your JS code to see if there's problem there.



来源:https://stackoverflow.com/questions/16488032/webview-killing-the-whole-activity-how-can-i-debug-this

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!