0

When i port my old demo application from platform 6.0 to 7.0, fatal crash comes across. It looks like is relative to linker with platform so library, but crash back trace seems problem comes from Activity starting process. Does some body has any ideal about this condition? Back trace is:

01-08 01:27:01.750  2398  3264 I ActivityManager: Start proc 19184:com.company.demo/u0a43 for activity com.company.demo/.MainActivity
01-08 01:27:01.769  2398  3265 W SchedPolicy: add_tid_to_cgroup failed to write '19184' (Permission denied); fd=30
01-08 01:27:01.769  2398  3265 W ActivityManager: Failed setting process group of 19184 to 2
01-08 01:27:01.827 19184 19184 W linker  : library "/vendor/lib/libsdk.so" ("/system/vendor/lib/libsdk.so") needed or dlopened by "/system/lib/libnativeloader.so" is not accessible for the namespace "classloader-namespace" - the access is temporarily granted as a workaround for http://b/26394120, note that the access will be removed in future releases of Android.
01-08 01:27:01.828 19184 19184 W linker  : library "libsyssdk.so" ("/system/lib/libsyssdk.so") needed or dlopened by "/system/vendor/lib/libsdk.so" is not accessible for the namespace "classloader-namespace" - the access is temporarily granted as a workaround for http://b/26394120, note that the access will be removed in future releases of Android.
01-08 01:27:01.849 19184 19184 I company.demo: type=1400 audit(0.0:151): avc: denied { read } for name="/" dev="tmpfs" ino=8216 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:device:s0 tclass=dir permissive=1
01-08 01:27:01.849 19184 19184 I company.demo: type=1400 audit(0.0:152): avc: denied { open } for path="/dev" dev="tmpfs" ino=8216 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:device:s0 tclass=dir permissive=1
01-08 01:27:01.870 19184 19184 F libc    : Fatal signal 11 (SIGSEGV), code 1, fault addr 0x4 in tid 19184 (company.demo)
01-08 01:27:01.871  2207  2207 W         : debuggerd: handling request: pid=19184 uid=10043 gid=10043 tid=19184
01-08 01:27:01.938 19203 19203 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
01-08 01:27:01.938 19203 19203 F DEBUG   : Revision: '0'
01-08 01:27:01.938 19203 19203 F DEBUG   : ABI: 'arm'
01-08 01:27:01.938 19203 19203 F DEBUG   : pid: 19184, tid: 19184, name: company.demo  >>> com.company.demo <<<
01-08 01:27:01.938 19203 19203 F DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x4
01-08 01:27:01.938 19203 19203 F DEBUG   :     r0 00000000  r1 00000004  r2 0000001c  r3 0000001d
01-08 01:27:01.938 19203 19203 F DEBUG   :     r4 ea933e00  r5 ea9e2d80  r6 00000005  r7 ebc42ff8
01-08 01:27:01.938 19203 19203 F DEBUG   :     r8 ffb2bd20  r9 ea9e2da8  sl f47f6a70  fp ffffffff
01-08 01:27:01.938 19203 19203 F DEBUG   :     ip f6adbf08  sp ffb2bcc0  lr f6acad23  pc f4f7dde0  cpsr 00070030
01-08 01:27:02.448 19203 19203 F DEBUG   : 
01-08 01:27:02.448 19203 19203 F DEBUG   : backtrace:
01-08 01:27:02.448 19203 19203 F DEBUG   :     #00 pc 0000bde0  /system/lib/libutils.so (_ZNK7android7RefBase14forceIncStrongEPKv+3)
01-08 01:27:02.448 19203 19203 F DEBUG   :     #01 pc 0004ed1f  /system/lib/libbinder.so (_ZN7android12ProcessState23getStrongProxyForHandleEi+86)
01-08 01:27:02.448 19203 19203 F DEBUG   :     #02 pc 000411a7  /system/lib/libbinder.so (_ZN7android14acquire_objectERKNS_2spINS_12ProcessStateEEERK18flat_binder_objectPKvPj+190)
01-08 01:27:02.448 19203 19203 F DEBUG   :     #03 pc 000432d3  /system/lib/libbinder.so (_ZN7android6Parcel11writeObjectERK18flat_binder_objectb+250)
01-08 01:27:02.448 19203 19203 F DEBUG   :     #04 pc 000415bf  /system/lib/libbinder.so (_ZN7android14flatten_binderERKNS_2spINS_12ProcessStateEEERKNS0_INS_7IBinderEEEPNS_6ParcelE+154)
01-08 01:27:02.448 19203 19203 F DEBUG   :     #05 pc 00042e05  /system/lib/libbinder.so (_ZN7android6Parcel17writeStrongBinderERKNS_2spINS_7IBinderEEE+28)
01-08 01:27:02.448 19203 19203 F DEBUG   :     #06 pc 000931c5  /system/lib/libandroid_runtime.so
01-08 01:27:02.448 19203 19203 F DEBUG   :     #07 pc 01bc38d9  /system/framework/arm/boot-framework.oat (offset 0x159a000) (android.os.Parcel.nativeWriteStrongBinder+116)
01-08 01:27:02.448 19203 19203 F DEBUG   :     #08 pc 01bcaea5  /system/framework/arm/boot-framework.oat (offset 0x159a000) (android.os.Parcel.writeStrongBinder+56)
01-08 01:27:02.448 19203 19203 F DEBUG   :     #09 pc 015f3be5  /system/framework/arm/boot-framework.oat (offset 0x159a000) (android.app.ActivityManagerProxy.getActivityOptions+112)
01-08 01:27:02.449 19203 19203 F DEBUG   :     #10 pc 015ab2bf  /system/framework/arm/boot-framework.oat (offset 0x159a000) (android.app.Activity.getActivityOptions+74)
01-08 01:27:02.449 19203 19203 F DEBUG   :     #11 pc 015b02d3  /system/framework/arm/boot-framework.oat (offset 0x159a000) (android.app.Activity.performStart+46)
01-08 01:27:02.449 19203 19203 F DEBUG   :     #12 pc 0162091d  /system/framework/arm/boot-framework.oat (offset 0x159a000) (android.app.ActivityThread.performLaunchActivity+1832)
01-08 01:27:02.449 19203 19203 F DEBUG   :     #13 pc 0161b82d  /system/framework/arm/boot-framework.oat (offset 0x159a000) (android.app.ActivityThread.handleLaunchActivity+176)
01-08 01:27:02.449 19203 19203 F DEBUG   :     #14 pc 01612f09  /system/framework/arm/boot-framework.oat (offset 0x159a000) (android.app.ActivityThread.-wrap12+60)
01-08 01:27:02.449 19203 19203 F DEBUG   :     #15 pc 01610ef5  /system/framework/arm/boot-framework.oat (offset 0x159a000) (android.app.ActivityThread$H.handleMessage+5488)
01-08 01:27:02.449 19203 19203 F DEBUG   :     #16 pc 0160e23d  /system/framework/arm/boot-framework.oat (offset 0x159a000) (android.os.Handler.dispatchMessage+112)
01-08 01:27:02.449 19203 19203 F DEBUG   :     #17 pc 01bbbc81  /system/framework/arm/boot-framework.oat (offset 0x159a000) (android.os.Looper.loop+716)
01-08 01:27:02.449 19203 19203 F DEBUG   :     #18 pc 0161f405  /system/framework/arm/boot-framework.oat (offset 0x159a000) (android.app.ActivityThread.main+424)
01-08 01:27:02.449 19203 19203 F DEBUG   :     #19 pc 000a8fc1  /system/lib/libart.so (art_quick_invoke_stub_internal+64)
01-08 01:27:02.449 19203 19203 F DEBUG   :     #20 pc 00404ead  /system/lib/libart.so (art_quick_invoke_static_stub+228)
01-08 01:27:02.449 19203 19203 F DEBUG   :     #21 pc 000b02b3  /system/lib/libart.so (_ZN3art9ArtMethod6InvokeEPNS_6ThreadEPjjPNS_6JValueEPKc+178)
01-08 01:27:02.449 19203 19203 F DEBUG   :     #22 pc 0031481b  /system/lib/libart.so (_ZN3artL18InvokeWithArgArrayERKNS_33ScopedObjectAccessAlreadyRunnableEPNS_9ArtMethodEPNS_8ArgArrayEPNS_6JValueEPKc+58)
01-08 01:27:02.449 19203 19203 F DEBUG   :     #23 pc 00315b8f  /system/lib/libart.so (_ZN3art12InvokeMethodERKNS_33ScopedObjectAccessAlreadyRunnableEP8_jobjectS4_S4_j+766)
01-08 01:27:02.449 19203 19203 F DEBUG   :     #24 pc 002bcaa5  /system/lib/libart.so (_ZN3artL13Method_invokeEP7_JNIEnvP8_jobjectS3_S3_+40)
01-08 01:27:02.449 19203 19203 F DEBUG   :     #25 pc 005adba9  /system/framework/arm/boot.oat (offset 0x51a000) (java.lang.reflect.Method.invoke+116)
01-08 01:27:02.449 19203 19203 F DEBUG   :     #26 pc 020b06f9  /system/framework/arm/boot-framework.oat (offset 0x159a000) (com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run+100)
01-08 01:27:02.449 19203 19203 F DEBUG   :     #27 pc 020b157d  /system/framework/arm/boot-framework.oat (offset 0x159a000) (com.android.internal.os.ZygoteInit.main+1216)
01-08 01:27:02.449 19203 19203 F DEBUG   :     #28 pc 000a8fc1  /system/lib/libart.so (art_quick_invoke_stub_internal+64)
01-08 01:27:02.449 19203 19203 F DEBUG   :     #29 pc 00404ead  /system/lib/libart.so (art_quick_invoke_static_stub+228)
01-08 01:27:02.449 19203 19203 F DEBUG   :     #30 pc 000b02b3  /system/lib/libart.so (_ZN3art9ArtMethod6InvokeEPNS_6ThreadEPjjPNS_6JValueEPKc+178)
01-08 01:27:02.449 19203 19203 F DEBUG   :     #31 pc 0031481b  /system/lib/libart.so (_ZN3artL18InvokeWithArgArrayERKNS_33ScopedObjectAccessAlreadyRunnableEPNS_9ArtMethodEPNS_8ArgArrayEPNS_6JValueEPKc+58)
01-08 01:27:02.449 19203 19203 F DEBUG   :     #32 pc 0031462b  /system/lib/libart.so (_ZN3art17InvokeWithVarArgsERKNS_33ScopedObjectAccessAlreadyRunnableEP8_jobjectP10_jmethodIDSt9__va_list+266)
01-08 01:27:02.449 19203 19203 F DEBUG   :     #33 pc 00276d37  /system/lib/libart.so (_ZN3art3JNI21CallStaticVoidMethodVEP7_JNIEnvP7_jclassP10_jmethodIDSt9__va_list+426)
01-08 01:27:02.449 19203 19203 F DEBUG   :     #34 pc 00066d01  /system/lib/libandroid_runtime.so
01-08 01:27:02.449 19203 19203 F DEBUG   :     #35 pc 000685cf  /system/lib/libandroid_runtime.so (_ZN7android14AndroidRuntime5startEPKcRKNS_6VectorINS_7String8EEEb+498)
01-08 01:27:02.450 19203 19203 F DEBUG   :     #36 pc 00001945  /system/bin/app_process32
01-08 01:27:02.450 19203 19203 F DEBUG   :     #37 pc 00016c61  /system/lib/libc.so (__libc_init+48)
01-08 01:27:02.450 19203 19203 F DEBUG   :     #38 pc 00001564  /system/bin/app_process32
01-08 01:27:02.804  2398 19209 W ActivityManager:   Force finishing activity com.company.demo/.MainActivity
01-08 01:27:02.805  2207  2207 W         : debuggerd: resuming target 19184
01-08 01:27:02.806  2398  2420 I BootReceiver: Copying /data/tombstones/tombstone_01 to DropBox (SYSTEM_TOMBSTONE)
01-08 01:27:02.812  2398  2398 V ActivityManager: Broadcast: Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } ordered=false userid=0
01-08 01:27:02.812  2398  2398 V ActivityManager: Enqueing broadcast: android.intent.action.DROPBOX_ENTRY_ADDED replacePending=false
01-08 01:27:02.822  2398  2398 V ActivityManager: Broadcast: Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } ordered=false userid=0
01-08 01:27:02.822  2398  2398 V ActivityManager: Enqueing broadcast: android.intent.action.DROPBOX_ENTRY_ADDED replacePending=false
01-08 01:27:02.869  2398  2947 I ActivityManager: Process com.company.demo (pid 19184) has died
01-08 01:27:02.869  2398  2947 D ActivityManager: cleanUpApplicationRecord -- 19184
01-08 01:27:02.870  2302  2302 I Zygote  : Process 19184 exited due to signal (11)
01-08 01:27:02.882  2398  2423 I WindowManager: Destroying surface Surface(name=Starting com.company.demo) called by com.android.server.wm.WindowStateAnimator.destroySurface:2033 com.android.server.wm.WindowStateAnimator.destroySurfaceLocked:884 com.android.server.wm.WindowState.removeLocked:1471 com.android.server.wm.WindowManagerService.removeWindowInnerLocked:2490 com.android.server.wm.WindowManagerService.removeWindowLocked:2448 com.android.server.wm.WindowManagerService.removeWindowLocked:2317 com.android.server.wm.WindowManagerService.removeWindow:2312 com.android.server.wm.Session.remove:193 

Demo Activity is simple:

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mRootView = (ViewGroup) findViewById(R.id.rootView);
    Logger.LOGI("Before new VrSurfaceView");
    mSurfaceView = new CustomSurfaceView(MainActivity.this);
    Logger.LOGI("After new VrSurfaceView");
    LayoutParams lParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    mRootView.addView(mSurfaceView, lParams);
    mSurfaceView.getHolder().addCallback(new Callback() {

        @Override
        public void surfaceDestroyed(SurfaceHolder holder) {
            Logger.LOGI("surfaceDestroyed");
        }

        @Override
        public void surfaceCreated(SurfaceHolder holder) {
            Logger.LOGI("surfaceCreated");
        }

        @Override
        public void surfaceChanged(SurfaceHolder holder, int format, int width,
                int height) {
            Logger.LOGI("surfaceChanged");
        }
    });
    Logger.LOGI("onCreate finished(before sleep): " + mSurfaceView.getAppPtr());
    try {
        Thread.sleep(4 * 1000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    Logger.LOGI("onCreate finished(after sleep): " + mSurfaceView.getAppPtr());
}

@Override
protected void onStart() {
    super.onStart();
    Logger.LOGI("onStart");
}

sleep operation in onCreate is used to check if crash happens in other thread, and result is after 4 seconds(onCreate called), application crashed as before. onStart is never be called. CustomSurfaceView's parent VrSurfaceView will load the libsdk.so located at /system/vendor/lib/ directory.

/**
 * Abstract parent VrSurfaceView, with vr rendering support.
 */
public abstract class VrSurfaceView extends SurfaceView implements SurfaceHolder.Callback {

    private long appPtr;

    public VrSurfaceView(Activity activity) {
        super(activity.getApplicationContext());
        appPtr = nativeSetView(this, activity);
        getHolder().addCallback(this);
    }

    /**
     * @return appInterface pointer
     */
    public long getAppPtr() {
        return appPtr;
    }

    @Override
    public void surfaceCreated(SurfaceHolder holder) {
    }

    @Override
    public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
        onSurfaceChanged(appPtr, holder.getSurface(), width, height);
    }

    @Override
    public void surfaceDestroyed(SurfaceHolder holder) {
        onSurfaceDestroyed(appPtr);
    }

    /**
     * must called by activity lifeCycle callback
     */
    public void onPause() {
        dealPause(appPtr);
    }

    /**
     * must called by activity lifeCycle callback
     */
    public void onResume() {
        dealResume(appPtr);
    }

    /**
     * must called by activity lifeCycle callback
     */
    public void onDestroy() {
        dealDestroy(appPtr);
    }

    /**
     * called by native initial logic
     */
    public abstract void init(int width, int height);

    /* callback of surfaceView lifeCycle */
    public static native void onSurfaceChanged(long appPtr, Surface s, int width, int height);

    public static native void onSurfaceDestroyed(long appPtr);

    /* callback of activity lifeCycle */
    public static native void dealPause(long appPtr);

    public static native void dealResume(long appPtr);

    public static native void dealDestroy(long appPtr);

    public static native long nativeSetView(VrSurfaceView view, Activity activity);

    static {
        System.loadLibrary("sdk"); // load system so library here
    }
}

I also checked the libsdk.so used only Android Published NDK APIs, so it may not because of usage of platform so library. It is so confused...

AJ2016
  • 1
  • 1
  • (Permission denied); – amorenew Oct 11 '17 at 08:10
  • you should put your activity code in your question – amorenew Oct 11 '17 at 08:11
  • 1
    @amorenew This log(Permission denied) is just a warning, other application which running great also has this log before it's start. The MainActivity's main logic code is added. – AJ2016 Oct 11 '17 at 09:10
  • I think it's related to surfaceView – amorenew Oct 11 '17 at 09:27
  • try android 8 and vmSafeMode="true" https://stackoverflow.com/questions/37101603/app-crashes-sometimes-with-fatal-signal-11-sigsegv-code-1 – amorenew Oct 11 '17 at 09:28
  • 1
    @amorenew Thank you so much. But Android version is fixed because of ours' special device;I also tried to load library in a simple class(has no parent), which crash as before. – AJ2016 Oct 11 '17 at 10:10

0 Answers0