oblac / jodd

Jodd! Lightweight. Java. Zero dependencies. Use what you like.
https://jodd.org
BSD 2-Clause "Simplified" License
4.06k stars 723 forks source link

jodd-lagarto crashed on android 6.0 #241

Closed emanonwzy closed 9 years ago

emanonwzy commented 9 years ago

Version:

3.6.6

Appearance:

Jerry object cannot be instantiated

Jerry jerry = Jerry.jerry("hello world");

code url

Crash log

10-08 19:17:38.287 D/audio_hw_primary(  200): disable_audio_route: reset and update mixer path: low-latency-playback
10-08 19:17:38.287 D/audio_hw_primary(  200): disable_snd_device: snd_device(2: speaker)
10-08 19:17:38.601 D/audio_hw_primary(  200): out_set_parameters: enter: usecase(1: low-latency-playback) kvpairs: routing=2
10-08 19:17:38.602 I/ActivityManager(  779): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=org.wzy.testjerry/.MainActivity bnds=[276,870][540,1167] (has extras)} from uid 10027 on display 0
10-08 19:17:38.612 D/audio_hw_primary(  200): select_devices: out_snd_device(2: speaker) in_snd_device(0: none)
10-08 19:17:38.612 D/msm8974_platform(  200): platform_send_audio_calibration: sending audio calibration for snd_device(2) acdb_id(15)
10-08 19:17:38.612 D/audio_hw_primary(  200): enable_snd_device: snd_device(2: speaker)
10-08 19:17:38.615 D/audio_hw_primary(  200): enable_audio_route: apply and update mixer path: low-latency-playback
10-08 19:17:38.634 D/AudioFlinger(  200): mixer(0xb4100000) throttle end: throttle time(10)
10-08 19:17:38.648 I/ActivityManager(  779): Start proc 21077:org.wzy.testjerry/u0a87 for activity org.wzy.testjerry/.MainActivity
10-08 19:17:38.670 I/art     (21077): Late-enabling -Xcheck:jni
10-08 19:17:38.707 D/GCoreFlp( 1506): FLP HAL exists but batch size is <= 0.  Disabling FLP HAL.
10-08 19:17:38.734 I/art     (  779): Background partial concurrent mark sweep GC freed 54405(3MB) AllocSpace objects, 7(260KB) LOS objects, 33% free, 25MB/38MB, paused 1.027ms total 102.651ms
10-08 19:17:38.744 E/Surface ( 3770): getSlotFromBufferLocked: unknown buffer: 0x9b3b3c30
10-08 19:17:38.752 W/System  (21077): ClassLoader referenced unknown path: /data/app/org.wzy.testjerry-2/lib/arm
10-08 19:17:38.810 F/libc    (21077): Fatal signal 11 (SIGSEGV), code 1, fault addr 0xcb998000 in tid 21077 (g.wzy.testjerry)
10-08 19:17:38.911 F/DEBUG   (  197): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
10-08 19:17:38.911 F/DEBUG   (  197): Build fingerprint: 'google/hammerhead/hammerhead:6.0/MRA58K/2256973:user/release-keys'
10-08 19:17:38.912 F/DEBUG   (  197): Revision: '0'
10-08 19:17:38.912 F/DEBUG   (  197): ABI: 'arm'
10-08 19:17:38.912 F/DEBUG   (  197): pid: 21077, tid: 21077, name: g.wzy.testjerry  >>> org.wzy.testjerry <<<
10-08 19:17:38.912 F/DEBUG   (  197): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xcb998000
10-08 19:17:38.922 F/DEBUG   (  197):     r0 70764090  r1 0000000a  r2 00007460  r3 0000000b
10-08 19:17:38.923 F/DEBUG   (  197):     r4 70cb9ca8  r5 b4d3c928  r6 cb998000  r7 b6d9eec0
10-08 19:17:38.923 F/DEBUG   (  197):     r8 b4df6a00  r9 710b2a28  sl 00000539  fp 71179660
10-08 19:17:38.923 F/DEBUG   (  197):     ip 711eac68  sp bed8de60  lr 70765574  pc b4c75470  cpsr 000d0030
10-08 19:17:38.926 F/DEBUG   (  197):
10-08 19:17:38.926 F/DEBUG   (  197): backtrace:
10-08 19:17:38.926 F/DEBUG   (  197):     #00 pc 0039e470  /system/lib/libart.so (art::CheckReferenceResult(art::mirror::Object*, art::Thread*)+127)
10-08 19:17:38.926 F/DEBUG   (  197):     #01 pc 000e5775  /system/lib/libart.so (art::JniMethodEndWithReference(_jobject*, unsigned int, art::Thread*)+88)
10-08 19:17:38.926 F/DEBUG   (  197):     #02 pc 7349d811  /data/dalvik-cache/arm/system@framework@boot.oat (offset 0x1eb1000)
10-08 19:17:39.183 F/DEBUG   (  197):
10-08 19:17:39.183 F/DEBUG   (  197): Tombstone written to: /data/tombstones/tombstone_05
10-08 19:17:39.183 E/DEBUG   (  197): AM write failed: Broken pipe
10-08 19:17:39.183 W/ActivityManager(  779):   Force finishing activity org.wzy.testjerry/.MainActivity
10-08 19:17:39.183 I/BootReceiver(  779): Copying /data/tombstones/tombstone_05 to DropBox (SYSTEM_TOMBSTONE)
10-08 19:17:39.204 I/Zygote  (  212): Process 21077 exited due to signal (11)
10-08 19:17:39.497 I/WindowManager(  779): Screenshot max retries 4 of Token{e139578 ActivityRecord{81ec6db u0 org.wzy.testjerry/.MainActivity t56 f}} appWin=Window{85d3653 u0 Starting org.wzy.testjerry} drawState=4
10-08 19:17:39.498 W/ActivityManager(  779): Exception thrown during pause
10-08 19:17:39.498 W/ActivityManager(  779): android.os.DeadObjectException
10-08 19:17:39.498 W/ActivityManager(  779):    at android.os.BinderProxy.transactNative(Native Method)
10-08 19:17:39.498 W/ActivityManager(  779):    at android.os.BinderProxy.transact(Binder.java:503)
10-08 19:17:39.498 W/ActivityManager(  779):    at android.app.ApplicationThreadProxy.schedulePauseActivity(ApplicationThreadNative.java:727)
10-08 19:17:39.498 W/ActivityManager(  779):    at com.android.server.am.ActivityStack.startPausingLocked(ActivityStack.java:867)
10-08 19:17:39.498 W/ActivityManager(  779):    at com.android.server.am.ActivityStack.finishActivityLocked(ActivityStack.java:2907)
10-08 19:17:39.498 W/ActivityManager(  779):    at com.android.server.am.ActivityStack.finishTopRunningActivityLocked(ActivityStack.java:2763)
10-08 19:17:39.498 W/ActivityManager(  779):    at com.android.server.am.ActivityStackSupervisor.finishTopRunningActivityLocked(ActivityStackSupervisor.java:2755)
10-08 19:17:39.498 W/ActivityManager(  779):    at com.android.server.am.ActivityManagerService.handleAppCrashLocked(ActivityManagerService.java:11971)
10-08 19:17:39.498 W/ActivityManager(  779):    at com.android.server.am.ActivityManagerService.makeAppCrashingLocked(ActivityManagerService.java:11867)
10-08 19:17:39.498 W/ActivityManager(  779):    at com.android.server.am.ActivityManagerService.crashApplication(ActivityManagerService.java:12556)
10-08 19:17:39.498 W/ActivityManager(  779):    at com.android.server.am.ActivityManagerService.handleApplicationCrashInner(ActivityManagerService.java:12063)
10-08 19:17:39.498 W/ActivityManager(  779):    at com.android.server.am.NativeCrashListener$NativeCrashReporter.run(NativeCrashListener.java:86)
10-08 19:17:39.516 I/ActivityManager(  779): Process org.wzy.testjerry (pid 21077) has died
10-08 19:17:39.570 W/InputMethodManagerService(  779): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@eb4579f attribute=null, token = android.os.BinderProxy@79c7e6f
10-08 19:17:39.572 I/OpenGLRenderer(  779): Initialized EGL, version 1.4
10-08 19:17:39.577 W/LocationOracleImpl(16431): Best location was null
10-08 19:17:39.608 W/WindowManager(  779): On display=0 Rebuild removed 3 windows but added 2
10-08 19:17:39.608 W/WindowManager(  779): java.lang.RuntimeException: here
10-08 19:17:39.608 W/WindowManager(  779):  at com.android.server.wm.WindowManagerService.rebuildAppWindowListLocked(WindowManagerService.java:8832)
10-08 19:17:39.608 W/WindowManager(  779):  at com.android.server.wm.WindowManagerService.rebuildAppWindowListLocked(WindowManagerService.java:8756)
10-08 19:17:39.608 W/WindowManager(  779):  at com.android.server.wm.WindowManagerService.handleAppTransitionReadyLocked(WindowManagerService.java:9263)
10-08 19:17:39.608 W/WindowManager(  779):  at com.android.server.wm.WindowManagerService.performLayoutAndPlaceSurfacesLockedInner(WindowManagerService.java:10170)
10-08 19:17:39.608 W/WindowManager(  779):  at com.android.server.wm.WindowManagerService.performLayoutAndPlaceSurfacesLockedLoop(WindowManagerService.java:8980)
10-08 19:17:39.608 W/WindowManager(  779):  at com.android.server.wm.WindowManagerService.performLayoutAndPlaceSurfacesLocked(WindowManagerService.java:8927)
10-08 19:17:39.608 W/WindowManager(  779):  at com.android.server.wm.WindowManagerService.-wrap6(WindowManagerService.java)
10-08 19:17:39.608 W/WindowManager(  779):  at com.android.server.wm.WindowManagerService$H.handleMessage(WindowManagerService.java:7822)
10-08 19:17:39.608 W/WindowManager(  779):  at android.os.Handler.dispatchMessage(Handler.java:102)
10-08 19:17:39.608 W/WindowManager(  779):  at android.os.Looper.loop(Looper.java:148)
10-08 19:17:39.608 W/WindowManager(  779):  at android.os.HandlerThread.run(HandlerThread.java:61)
10-08 19:17:39.608 W/WindowManager(  779):  at com.android.server.ServiceThread.run(ServiceThread.java:46)
10-08 19:17:39.608 W/WindowManager(  779): This window was lost: Window{85d3653 u0 Starting org.wzy.testjerry}
10-08 19:17:39.608 W/WindowManager(  779): mDisplayId=-1 stackId=7 mSession=Session{abfeb18 779:1000} mClient=android.view.ViewRootImpl$W@6174642
10-08 19:17:39.608 W/WindowManager(  779): mOwnerUid=1000 mShowToOwnerOnly=false package=org.wzy.testjerry appop=NONE
10-08 19:17:39.608 W/WindowManager(  779): mAttrs=WM.LayoutParams{(0,0)(fillxfill) sim=#20 ty=3 fl=#81830118 pfl=0x11 wanim=0x103045b vsysui=0x600 needsMenuKey=2}
10-08 19:17:39.608 W/WindowManager(  779): Requested w=1080 h=1776 mLayoutSeq=3040
10-08 19:17:39.608 W/WindowManager(  779): mBaseLayer=21000 mSubLayer=0 mAnimLayer=21005+0=21005 mLastLayer=21015
10-08 19:17:39.608 W/WindowManager(  779): mToken=AppWindowToken{d6f9b90 token=Token{e139578 ActivityRecord{81ec6db u0 org.wzy.testjerry/.MainActivity t56}}}
10-08 19:17:39.608 W/WindowManager(  779): mRootToken=AppWindowToken{d6f9b90 token=Token{e139578 ActivityRecord{81ec6db u0 org.wzy.testjerry/.MainActivity t56}}}
10-08 19:17:39.608 W/WindowManager(  779): mAppToken=AppWindowToken{d6f9b90 token=Token{e139578 ActivityRecord{81ec6db u0 org.wzy.testjerry/.MainActivity t56}}}
10-08 19:17:39.608 W/WindowManager(  779): mViewVisibility=0x0 mHaveFrame=true mObscured=false
10-08 19:17:39.608 W/WindowManager(  779): mSeq=0 mSystemUiVisibility=0x600
10-08 19:17:39.608 W/WindowManager(  779): mGivenContentInsets=[0,0][0,0] mGivenVisibleInsets=[0,0][0,0]
10-08 19:17:39.608 W/WindowManager(  779): mConfiguration={1.0 ?mcc?mnc zh_CN ldltr sw360dp w360dp h568dp 480dpi nrml port finger -keyb/v/h -nav/h s.7}
10-08 19:17:39.608 W/WindowManager(  779): mHasSurface=false mShownFrame=[0.0,0.0][1080.0,1920.0] isReadyForDisplay()=false
10-08 19:17:39.608 W/WindowManager(  779): mFrame=[0,0][1080,1920] last=[0,0][1080,1920]
10-08 19:17:39.608 W/WindowManager(  779): mSystemDecorRect=[0,0][1080,1920] last=[0,0][0,0] mLastClipRect=[0,0][1080,1920]
10-08 19:17:39.608 W/WindowManager(  779): Frames: containing=[0,0][1080,1920] parent=[0,0][1080,1920]
10-08 19:17:39.608 W/WindowManager(  779):     display=[0,0][1080,1920] overscan=[0,0][1080,1920]
10-08 19:17:39.608 W/WindowManager(  779):     content=[0,72][1080,1776] visible=[0,72][1080,1776]
10-08 19:17:39.608 W/WindowManager(  779):     decor=[0,0][1080,1920]
10-08 19:17:39.608 W/WindowManager(  779):     outset=[0,0][0,0]
10-08 19:17:39.608 W/WindowManager(  779): Cur insets: overscan=[0,0][0,0] content=[0,72][0,144] visible=[0,72][0,144] stable=[0,72][0,144] outsets=[0,0][0,0]
10-08 19:17:39.608 W/WindowManager(  779): Lst insets: overscan=[0,0][0,0] content=[0,72][0,144] visible=[0,72][0,144] stable=[0,72][0,144] physical=[0,0][0,0] outset=[0,0][0,0]
10-08 19:17:39.608 W/WindowManager(  779): WindowStateAnimator{790cebb Starting org.wzy.testjerry}:
10-08 19:17:39.608 W/WindowManager(  779): mExiting=false mRemoveOnExit=false mDestroying=false mRemoved=true
10-08 19:17:39.608 W/WindowManager(  779): Current app token list:
10-08 19:17:39.608 V/WindowManager(  779):   Stack #0 tasks from bottom to top:
10-08 19:17:39.608 V/WindowManager(  779):     Task #16 activities from bottom to top:
10-08 19:17:39.608 V/WindowManager(  779):       activity #0: Token{ee28797 ActivityRecord{c6dc216 u0 com.android.systemui/.recents.RecentsActivity t16}}
10-08 19:17:39.608 V/WindowManager(  779):     Task #3 activities from bottom to top:
10-08 19:17:39.608 V/WindowManager(  779):       activity #0: Token{1501777 ActivityRecord{d9a2576 u0 com.google.android.googlequicksearchbox/com.google.android.launcher.GEL t3}}
10-08 19:17:39.608 W/WindowManager(  779): Final window list:
10-08 19:17:39.608 V/WindowManager(  779):  Display #0
10-08 19:17:39.608 V/WindowManager(  779):   #8: Window{8159374 u0 NavigationBar}
10-08 19:17:39.608 V/WindowManager(  779):   #7: Window{64d43ae u0 StatusBar}
10-08 19:17:39.608 V/WindowManager(  779):   #6: Window{3244348 u0 KeyguardScrim}
10-08 19:17:39.608 V/WindowManager(  779):   #5: Window{9f42d3e u0 Application Error: org.wzy.testjerry}
10-08 19:17:39.608 V/WindowManager(  779):   #4: Window{66cd015 u0 AssistPreviewPanel}
10-08 19:17:39.608 V/WindowManager(  779):   #3: Window{11aba1b u0 InputMethod}
10-08 19:17:39.608 V/WindowManager(  779):   #2: Window{501d77c u0 com.google.android.googlequicksearchbox/com.google.android.launcher.GEL}
10-08 19:17:39.608 V/WindowManager(  779):   #1: Window{6e682a1 u0 com.android.systemui/com.android.systemui.recents.RecentsActivity}
10-08 19:17:39.608 V/WindowManager(  779):   #0: Window{208f9be u0 com.android.systemui.ImageWallpaper}
10-08 19:17:39.625 W/GCoreFlp( 1506): No location to return for getLastLocation()
10-08 19:17:39.645 W/GCoreFlp( 1506): No location to return for getLastLocation()
10-08 19:17:39.662 W/GCoreFlp( 1506): No location to return for getLastLocation()
10-08 19:17:39.662 I/Icing   ( 1545): Usage reports 1 indexed 0 rejected 0 imm upload true
10-08 19:17:39.684 D/GCoreFlp( 1506): FLP HAL exists but batch size is <= 0.  Disabling FLP HAL.
10-08 19:17:39.690 D/WifiService(  779): acquireWifiLockLocked: WifiLock{NlpWifiLock type=2 binder=android.os.BinderProxy@a523f08}
10-08 19:17:39.692 W/GCoreFlp( 1506): No location to return for getLastLocation()
10-08 19:17:39.713 D/GCoreFlp( 1506): FLP HAL exists but batch size is <= 0.  Disabling FLP HAL.
10-08 19:17:39.720 D/WifiService(  779): releaseWifiLockLocked: WifiLock{NlpWifiLock type=2 binder=android.os.BinderProxy@a523f08}
10-08 19:17:39.723 D/WifiService(  779): acquireWifiLockLocked: WifiLock{NlpWifiLock type=2 binder=android.os.BinderProxy@a523f08}
10-08 19:17:39.737 D/WifiService(  779): releaseWifiLockLocked: WifiLock{NlpWifiLock type=2 binder=android.os.BinderProxy@a523f08}
10-08 19:17:40.119 W/OpenGLRenderer( 3770): Incorrectly called buildLayer on View: em, destroying layer...
10-08 19:17:40.119 W/OpenGLRenderer( 3770): Incorrectly called buildLayer on View: em, destroying layer...
10-08 19:17:41.483 D/NetlinkSocketObserver(  779): NeighborEvent{elapsedMs=7324867, 192.168.0.1, [E4D3F1CCE1C3], RTM_NEWNEIGH, NUD_PROBE}
10-08 19:17:41.628 E/Surface (  779): getSlotFromBufferLocked: unknown buffer: 0x9502a610
10-08 19:17:41.632 D/audio_hw_primary(  200): out_set_parameters: enter: usecase(1: low-latency-playback) kvpairs: routing=2
10-08 19:17:41.635 W/InputMethodManagerService(  779): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@776117f attribute=null, token = android.os.BinderProxy@79c7e6f
10-08 19:17:41.657 W/LocationOracleImpl(16431): Best location was null
10-08 19:17:41.669 D/AudioFlinger(  200): mixer(0xb4100000) throttle end: throttle time(4)
10-08 19:17:41.682 W/GCoreFlp( 1506): No location to return for getLastLocation()
10-08 19:17:41.697 W/GCoreFlp( 1506): No location to return for getLastLocation()
10-08 19:17:41.704 W/GCoreFlp( 1506): No location to return for getLastLocation()
10-08 19:17:41.724 D/GCoreFlp( 1506): FLP HAL exists but batch size is <= 0.  Disabling FLP HAL.
10-08 19:17:41.731 W/GCoreFlp( 1506): No location to return for getLastLocation()
10-08 19:17:41.733 D/WifiService(  779): acquireWifiLockLocked: WifiLock{NlpWifiLock type=2 binder=android.os.BinderProxy@a523f08}
10-08 19:17:41.755 D/WifiService(  779): releaseWifiLockLocked: WifiLock{NlpWifiLock type=2 binder=android.os.BinderProxy@a523f08}
10-08 19:17:41.757 D/WifiService(  779): acquireWifiLockLocked: WifiLock{NlpWifiLock type=2 binder=android.os.BinderProxy@a523f08}
10-08 19:17:41.764 D/WifiService(  779): releaseWifiLockLocked: WifiLock{NlpWifiLock type=2 binder=android.os.BinderProxy@a523f08}
10-08 19:17:41.805 W/AppOps  (  779): Finishing op nesting under-run: uid 1000 pkg android code 24 time=0 duration=0 nesting=0
igr commented 9 years ago

Hey! Android! Niiice :)

I don't see any exception in the log regarding the Lagarto. Was it working on previous version of Android? Do you have all required jars deployed??

emanonwzy commented 9 years ago

Yes, It's worked on 4.x and 5.x, only crashed on 6.0. Through debug, it may be crashed on UnsafeUtil.getChars(string) in LagartoParser constructor

 /**
 * Creates parser on a String.
 */
public LagartoParser(String string, boolean emitStrings) {
    super(emitStrings);
    initialize(UnsafeUtil.getChars(string));
}

url

igr commented 9 years ago

Hmm... UnsafeUtil tries to use the unsafe method, but in case of exception, it should use ordinary getChars from a string. Would it be possible if you go step into the UnsafeUtil.getChars during the debugging?

slandelle commented 9 years ago

@igorspasic No, it can't work this way. UnsafeUtilclass won't load if sun.misc.Unsafe is missing, so every subsequent call to methods of this class will crash.

If you want to support Unsafe absence, you have to introduce a delegate, trap exceptions and then fallback. If you want to handle environments that are known to not have Unsafe, typically Android, you can detect them upfront. Have a look at io.netty.util.internal.PlatformDependent for an example.

igr commented 9 years ago

Ah, yes @slandelle , you mentioned PlatformDependent before already. Got it!

emanonwzy commented 9 years ago

@igorspasic It throw exception when invoked below

stringValueFieldOffset = unsafe.objectFieldOffset(String.class.getDeclaredField("value"));

And crashed in below

char[] value = (char[]) UNSAFE.getObject(string, STRING_VALUE_FIELD_OFFSET);

So can this be modified like this:

if (STRING_VALUE_FIELD_OFFSET ==  -1) {
    return string.toCharArray();
}
char[] value = (char[]) UNSAFE.getObject(string, STRING_VALUE_FIELD_OFFSET);
igr commented 9 years ago

Thank you @emanonwzy & @slandelle! Working this out:)

igr commented 9 years ago

Ok, commit b739570d0f3ed0665704d3041899e063452399d8 should make a difference ;) Any chance @emanonwzy to test the current version in Android? I dont have any around :(

emanonwzy commented 9 years ago

@igorspasic Thanks. I will test on my device

emanonwzy commented 9 years ago

It worked! Thank you very much. BTW. Do you have plan to release this fix?

igr commented 9 years ago

No worries, the snapshot release will be published to bintray until the 14th, so it's just in couple of days :) The snapshots are stable, so you may use it without any problems.

Happy coding!