Welcome to the Oculus Developer Forums!

Your participation on the forum is subject to the Oculus Code of Conduct.

In general, please be respectful and kind. If you violate the Oculus Code of Conduct, your access to the developer forums may be revoked at the discretion of Oculus staff.

declare a static OVR::String will cause crash even in oculus360videossdk when app launches

xiaoleijxiaoleij Posts: 1
NerveGear
edited May 2018 in Mobile Development
I am using native ovr_sdk_mobile_1.12.0.
the detailed log is as below:
05-02 20:21:24.394 20113 20113 F libc    : Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 20113 (lus360videossdk)
05-02 20:21:24.473 20127 20127 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
05-02 20:21:24.473 20127 20127 F DEBUG   : Build fingerprint: 'Verizon/heroqltevzw/heroqltevzw:7.0/NRD90M/G930VVRS4BQH1:user/release-keys'
05-02 20:21:24.473 20127 20127 F DEBUG   : Revision: '15'
05-02 20:21:24.473 20127 20127 F DEBUG   : ABI: 'arm'
05-02 20:21:24.474 20127 20127 F DEBUG   : pid: 20113, tid: 20113, name: lus360videossdk  >>> com.oculus.oculus360videossdk <<<
05-02 20:21:24.474 20127 20127 F DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
05-02 20:21:24.474 20127 20127 F DEBUG   :     r0 00000000  r1 e9b61380  r2 0000006f  r3 00000000
05-02 20:21:24.474 20127 20127 F DEBUG   :     r4 e9cf1630  r5 e9b61374  r6 00000005  r7 0000000b
05-02 20:21:24.474 20127 20127 F DEBUG   :     r8 ee6d0148  r9 ee6df5bc  sl ee6d0137  fp ffd00f00
05-02 20:21:24.474 20127 20127 F DEBUG   :     ip 80808000  sp ffd00ef0  lr e9c4c388  pc e9c4c3a0  cpsr 200d0010
05-02 20:21:24.906 20127 20127 F DEBUG   :
05-02 20:21:24.906 20127 20127 F DEBUG   : backtrace:
05-02 20:21:24.906 20127 20127 F DEBUG   :     #00 pc 001263a0  /data/app/com.oculus.oculus360videossdk-1/lib/arm/liboculus360videos.so
05-02 20:21:24.906 20127 20127 F DEBUG   :     #01 pc 0003b350  /data/app/com.oculus.oculus360videossdk-1/lib/arm/liboculus360videos.so
05-02 20:21:24.906 20127 20127 F DEBUG   :     #02 pc 00006039  /system/bin/linker (__dl__ZN6soinfo13call_functionEPKcPFvvE+84)
05-02 20:21:24.906 20127 20127 F DEBUG   :     #03 pc 00005f59  /system/bin/linker (__dl__ZN6soinfo10call_arrayEPKcPPFvvEjb+184)
05-02 20:21:24.906 20127 20127 F DEBUG   :     #04 pc 00004c43  /system/bin/linker (__dl__ZN6soinfo17call_constructorsEv+218)
05-02 20:21:24.906 20127 20127 F DEBUG   :     #05 pc 00004a55  /system/bin/linker (__dl__Z9do_dlopenPKciPK17android_dlextinfoPv+404)
05-02 20:21:24.907 20127 20127 F DEBUG   :     #06 pc 00002c4d  /system/bin/linker (__dl__ZL10dlopen_extPKciPK17android_dlextinfoPv+28)
05-02 20:21:24.907 20127 20127 F DEBUG   :     #07 pc 00003285  /system/lib/libnativeloader.so (_ZN7android17OpenNativeLibraryEP7_JNIEnviPKcP8_jobjectP8_jstring+96)
05-02 20:21:24.907 20127 20127 F DEBUG   :     #08 pc 00239d77  /system/lib/libart.so (_ZN3art9JavaVMExt17LoadNativeLibraryEP7_JNIEnvRKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEP8_jobjectP8_jstringPS9_+818)
05-02 20:21:24.907 20127 20127 F DEBUG   :     #09 pc 00003167  /system/lib/libopenjdkjvm.so (JVM_NativeLoad+178)
05-02 20:21:24.907 20127 20127 F DEBUG   :     #10 pc 005e0295  /system/framework/arm/boot.oat (offset 0x56f000) (java.lang.Runtime.nativeLoad+144)
05-02 20:21:24.907 20127 20127 F DEBUG   :     #11 pc 005dfed5  /system/framework/arm/boot.oat (offset 0x56f000) (java.lang.Runtime.doLoad+136)
05-02 20:21:24.907 20127 20127 F DEBUG   :     #12 pc 005e13b9  /system/framework/arm/boot.oat (offset 0x56f000) (java.lang.Runtime.loadLibrary0+540)
05-02 20:21:24.907 20127 20127 F DEBUG   :     #13 pc 005f4983  /system/framework/arm/boot.oat (offset 0x56f000) (java.lang.System.loadLibrary+78)
05-02 20:21:24.907 20127 20127 F DEBUG   :     #14 pc 000a91c1  /system/lib/libart.so (art_quick_invoke_stub_internal+64)
05-02 20:21:24.907 20127 20127 F DEBUG   :     #15 pc 00402759  /system/lib/libart.so (art_quick_invoke_static_stub+228)
05-02 20:21:24.907 20127 20127 F DEBUG   :     #16 pc 000b047f  /system/lib/libart.so (_ZN3art9ArtMethod6InvokeEPNS_6ThreadEPjjPNS_6JValueEPKc+178)
05-02 20:21:24.907 20127 20127 F DEBUG   :     #17 pc 001eba3d  /system/lib/libart.so (_ZN3art11interpreter34ArtInterpreterToCompiledCodeBridgeEPNS_6ThreadEPNS_9ArtMethodEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+200)
05-02 20:21:24.907 20127 20127 F DEBUG   :     #18 pc 001e5fed  /system/lib/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+492)
05-02 20:21:24.907 20127 20127 F DEBUG   :     #19 pc 003fb271  /system/lib/libart.so (MterpInvokeStatic+236)
05-02 20:21:24.907 20127 20127 F DEBUG   :     #20 pc 0009c194  /system/lib/libart.so (ExecuteMterpImpl+14612)
05-02 20:21:24.907 20127 20127 F DEBUG   :     #21 pc 001c9e37  /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+290)
05-02 20:21:24.907 20127 20127 F DEBUG   :     #22 pc 001ce909  /system/lib/libart.so (_ZN3art11interpreter30EnterInterpreterFromEntryPointEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameE+92)
05-02 20:21:24.907 20127 20127 F DEBUG   :     #23 pc 003f1b8f  /system/lib/libart.so (artQuickToInterpreterBridge+706)
05-02 20:21:24.907 20127 20127 F DEBUG   :     #24 pc 000adc13  /system/lib/libart.so (art_quick_to_interpreter_bridge+34)
05-02 20:21:24.907 20127 20127 F DEBUG   :     #25 pc 000a91c1  /system/lib/libart.so (art_quick_invoke_stub_internal+64)
05-02 20:21:24.907 20127 20127 F DEBUG   :     #26 pc 00402759  /system/lib/libart.so (art_quick_invoke_static_stub+228)
05-02 20:21:24.907 20127 20127 F DEBUG   :     #27 pc 000b047f  /system/lib/libart.so (_ZN3art9ArtMethod6InvokeEPNS_6ThreadEPjjPNS_6JValueEPKc+178)
05-02 20:21:24.907 20127 20127 F DEBUG   :     #28 pc 000ef72f  /system/lib/libart.so (_ZN3art11ClassLinker15InitializeClassEPNS_6ThreadENS_6HandleINS_6mirror5ClassEEEbb+3034)
05-02 20:21:24.907 20127 20127 F DEBUG   :     #29 pc 000dab69  /system/lib/libart.so (_ZN3art11ClassLinker17EnsureInitializedEPNS_6ThreadENS_6HandleINS_6mirror5ClassEEEbb+120)
05-02 20:21:24.907 20127 20127 F DEBUG   :     #30 pc 002ac919  /system/lib/libart.so (_ZN3artL17Class_newInstanceEP7_JNIEnvP8_jobject+1024)
05-02 20:21:24.907 20127 20127 F DEBUG   :     #31 pc 005c8291  /system/framework/arm/boot.oat (offset 0x56f000) (java.lang.Class.newInstance+76)
05-02 20:21:24.907 20127 20127 F DEBUG   :     #32 pc 01f84a35  /system/framework/arm/boot-framework.oat (offset 0x1e66000) (android.app.Instrumentation.newActivity+64)
05-02 20:21:24.907 20127 20127 F DEBUG   :     #33 pc 01efd369  /system/framework/arm/boot-framework.oat (offset 0x1e66000) (android.app.ActivityThread.performLaunchActivity+380)
05-02 20:21:24.907 20127 20127 F DEBUG   :     #34 pc 01ef80dd  /system/framework/arm/boot-framework.oat (offset 0x1e66000) (android.app.ActivityThread.handleLaunchActivity+176)
05-02 20:21:24.908 20127 20127 F DEBUG   :     #35 pc 01eee931  /system/framework/arm/boot-framework.oat (offset 0x1e66000) (android.app.ActivityThread.-wrap14+60)
05-02 20:21:24.908 20127 20127 F DEBUG   :     #36 pc 01eec93d  /system/framework/arm/boot-framework.oat (offset 0x1e66000) (android.app.ActivityThread$H.handleMessage+6392)
05-02 20:21:24.908 20127 20127 F DEBUG   :     #37 pc 01ee9903  /system/framework/arm/boot-framework.oat (offset 0x1e66000) (android.os.Handler.dispatchMessage+110)
05-02 20:21:24.908 20127 20127 F DEBUG   :     #38 pc 0256505f  /system/framework/arm/boot-framework.oat (offset 0x1e66000) (android.os.Looper.loop+698)
05-02 20:21:24.908 20127 20127 F DEBUG   :     #39 pc 01efc283  /system/framework/arm/boot-framework.oat (offset 0x1e66000) (android.app.ActivityThread.main+630)
05-02 20:21:24.908 20127 20127 F DEBUG   :     #40 pc 000a91c1  /system/lib/libart.so (art_quick_invoke_stub_internal+64)
05-02 20:21:24.908 20127 20127 F DEBUG   :     #41 pc 00402759  /system/lib/libart.so (art_quick_invoke_static_stub+228)
05-02 20:21:24.908 20127 20127 F DEBUG   :     #42 pc 000b047f  /system/lib/libart.so (_ZN3art9ArtMethod6InvokeEPNS_6ThreadEPjjPNS_6JValueEPKc+178)
05-02 20:21:24.908 20127 20127 F DEBUG   :     #43 pc 00313509  /system/lib/libart.so (_ZN3artL18InvokeWithArgArrayERKNS_33ScopedObjectAccessAlreadyRunnableEPNS_9ArtMethodEPNS_8ArgArrayEPNS_6JValueEPKc+56)
05-02 20:21:24.908 20127 20127 F DEBUG   :     #44 pc 0031489b  /system/lib/libart.so (_ZN3art12InvokeMethodERKNS_33ScopedObjectAccessAlreadyRunnableEP8_jobjectS4_S4_j+766)
05-02 20:21:24.908 20127 20127 F DEBUG   :     #45 pc 002bbd25  /system/lib/libart.so (_ZN3artL13Method_invokeEP7_JNIEnvP8_jobjectS3_S3_+40)
05-02 20:21:24.908 20127 20127 F DEBUG   :     #46 pc 00606261  /system/framework/arm/boot.oat (offset 0x56f000) (java.lang.reflect.Method.invoke+116)
05-02 20:21:24.908 20127 20127 F DEBUG   :     #47 pc 02b061c9  /system/framework/arm/boot-framework.oat (offset 0x1e66000) (com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run+100)
05-02 20:21:24.908 20127 20127 F DEBUG   :     #48 pc 02b07681  /system/framework/arm/boot-framework.oat (offset 0x1e66000) (com.android.internal.os.ZygoteInit.main+1260)
05-02 20:21:24.908 20127 20127 F DEBUG   :     #49 pc 000a91c1  /system/lib/libart.so (art_quick_invoke_stub_internal+64)
05-02 20:21:24.908 20127 20127 F DEBUG   :     #50 pc 00402759  /system/lib/libart.so (art_quick_invoke_static_stub+228)
05-02 20:21:24.908 20127 20127 F DEBUG   :     #51 pc 000b047f  /system/lib/libart.so (_ZN3art9ArtMethod6InvokeEPNS_6ThreadEPjjPNS_6JValueEPKc+178)
05-02 20:21:24.908 20127 20127 F DEBUG   :     #52 pc 00313509  /system/lib/libart.so (_ZN3artL18InvokeWithArgArrayERKNS_33ScopedObjectAccessAlreadyRunnableEPNS_9ArtMethodEPNS_8ArgArrayEPNS_6JValueEPKc+56)
05-02 20:21:24.908 20127 20127 F DEBUG   :     #53 pc 0031331b  /system/lib/libart.so (_ZN3art17InvokeWithVarArgsERKNS_33ScopedObjectAccessAlreadyRunnableEP8_jobjectP10_jmethodIDSt9__va_list+266)
05-02 20:21:24.908 20127 20127 F DEBUG   :     #54 pc 0027667f  /system/lib/libart.so (_ZN3art3JNI21CallStaticVoidMethodVEP7_JNIEnvP7_jclassP10_jmethodIDSt9__va_list+426)
05-02 20:21:24.908 20127 20127 F DEBUG   :     #55 pc 000699e1  /system/lib/libandroid_runtime.so
05-02 20:21:24.908 20127 20127 F DEBUG   :     #56 pc 0006b427  /system/lib/libandroid_runtime.so (_ZN7android14AndroidRuntime5startEPKcRKNS_6VectorINS_7String8EEEb+510)
05-02 20:21:24.908 20127 20127 F DEBUG   :     #57 pc 00002dcf  /system/bin/app_process32
05-02 20:21:24.908 20127 20127 F DEBUG   :     #58 pc 00016dd1  /system/lib/libc.so (__libc_init+48)
05-02 20:21:24.908 20127 20127 F DEBUG   :     #59 pc 000028e4  /system/bin/app_process32

Do you guys have had this issue before?

Comments

  • NelnoTheAmoebaNelnoTheAmoeba Posts: 19 Oculus Staff
    Hello, Xiaoleij,

    OVR::String relies on the LibOVRKernel function OVR::System::Init() to be called BEFORE any string data is allocated (because it uses the custom allocator supplied to OVR::System::Init()). 

    OVR::System::Init() is called from VrAppFramework/Src/App.cpp by the constructor of a static class:

    // Initialize and shutdown the app framework version of LibOVR.
    static struct InitShutdown
    {
    InitShutdown()
    {
    OVR::System::Init( OVR::Log::ConfigureDefaultLog( OVR::LogMask_All ) );
    }
    ~InitShutdown()
    {
    OVR::System::Destroy();
    }
    } GlobalInitShutdown;

    In C / C++ the order of static initialization across compilation units cannot be guaranteed. Depending on your build / compiler / project structure / etc. the static initialization could be anything, and changes to your project may actually change the order, meaning it works one day and suddenly crashes at some other point because of an unrelated chance, like a new .cpp file being added.

    It is therefore not safe to declare any OVR::String as a static because you cannot guarantee the allocator is initialized yet. This is also true for destruction -- if the App.cpp static code runs before your static OVR::String is destructed, the OVR::String destructor will likely crash.

    The solution is to avoid using OVR::String as a static. Add the string to your OVR::App-derived class. In general the samples and VrAppFramework should avoid using static objects that have any cross-compilation-unit dependencies. All data that is persistent across the application lifetime should be allocated as part of OVR::App or some other heap-allocated object that is created in or after OneTimeInit().

    -Jonathan
Sign In or Register to comment.