viromedia / viro

ViroReact: AR and VR using React Native
MIT License
2.28k stars 482 forks source link

App Crash when changing material with animation on ViroPolyline #442

Open finnpetersen opened 5 years ago

finnpetersen commented 5 years ago

Environment

Please provide the following information about your environment:

  1. Development OS: Windows 10
  2. Device OS & Version: Android 8.0.0
  3. Version: ViroReact version 2.11.0 and React Native version 0.55.1
  4. Device(s): Samsung Galaxy 7

Hi, I'm working on a feature for an AR app that allows you to draw freehand in the ar scene using ViroPolylines. Adding animations worked fine until I added material to the animation porperties, then the app crashes on start/deploy. This is the code for the materials and animations: ViroMaterials.createMaterials({ mars: { diffuseColor: 'red', diffuseIntensity: 0.4, }, earth: { diffuseColor: 'blue', diffuseIntensity: 0.1 }, }); ViroAnimations.registerAnimations({ loopOne: { properties: { scaleX:"+=0.2", scaleY:"+=0.2", scaleZ:"+=0.2", material:"earth" }, easing: "linear", duration: 4000 }, loopTwo: { properties: { scaleX:"-=0.2", scaleY:"-=0.2", scaleZ:"-=0.2", material:"mars" }, easing: "linear", duration: 4000 }, animatePipe: [["loopOne", "loopTwo"]], });

With this errorlog:

2018-10-19 09:17:47.142 12554-12616/com.arize.app W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.viromedia.bridge.component.VRTViroViewGroupManager$ViroLayoutShadowNode 2018-10-19 09:17:47.156 12554-12616/com.arize.app W/Viro: [**** ABORT ****] 2018-10-19 09:17:47.156 12554-12616/com.arize.app W/Viro:  File: /Users/Shared/Jenkins/Home/workspace/ViroRenderer_master-F3XEWEZRNV3GYGMXZ7G47K5KXZWXJUVIH2CWV4SVXAK2RCNI262Q/ViroRenderer/VROPlatformUtil.cpp 2018-10-19 09:17:47.156 12554-12616/com.arize.app W/Viro:  Line: 441 2018-10-19 09:17:47.156 12554-12616/com.arize.app W/Viro:  Function: getJNIEnv 2018-10-19 09:17:47.156 12554-12616/com.arize.app W/Viro:  Reason: ASSERTION FAILED Expression: sVM != nullptr

--------- beginning of crash

2018-10-19 09:17:47.306 12662-12616/? A/google-breakpad: Microdump skipped (uninteresting) 2018-10-19 09:17:47.321 12554-12616/com.arize.app W/google-breakpad: ### ### ### ### ### ### ### ### ### ### ### ### ### 2018-10-19 09:17:47.321 12554-12616/com.arize.app W/google-breakpad: Chrome build fingerprint: 2018-10-19 09:17:47.321 12554-12616/com.arize.app W/google-breakpad: 69.0.3497.100 2018-10-19 09:17:47.322 12554-12616/com.arize.app W/google-breakpad: 349710052 2018-10-19 09:17:47.322 12554-12616/com.arize.app W/google-breakpad: ### ### ### ### ### ### ### ### ### ### ### ### ### 2018-10-19 09:17:47.323 12554-12616/com.arize.app A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x9aa14a58 in tid 12616 (mqt_native_modu) 2018-10-19 09:17:47.433 12666-12666/? A/DEBUG: 2018-10-19 09:17:47.434 12666-12666/? A/DEBUG: Build fingerprint: 'samsung/heroltexx/herolte:8.0.0/R16NW/G930FXXS3ERI1:user/release-keys' 2018-10-19 09:17:47.434 12666-12666/? A/DEBUG: Revision: '8' 2018-10-19 09:17:47.434 12666-12666/? A/DEBUG: ABI: 'arm' 2018-10-19 09:17:47.434 12666-12666/? A/DEBUG: pid: 12554, tid: 12616, name: mqt_native_modu >>> com.arize.app <<< 2018-10-19 09:17:47.434 12666-12666/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x9aa14a58 2018-10-19 09:17:47.434 12666-12666/? A/DEBUG: r0 00000002 r1 00000000 r2 3ba5b1b1 r3 cd50a540 2018-10-19 09:17:47.434 12666-12666/? A/DEBUG: r4 cd50a560 r5 cd93fbd0 r6 cd50a4f8 r7 cd50a980 2018-10-19 09:17:47.434 12666-12666/? A/DEBUG: r8 cd50a55c r9 00000000 sl cd50a554 fp cd93fbd0 2018-10-19 09:17:47.434 12666-12666/? A/DEBUG: ip f3bd1850 sp cd50a540 lr cd93fadd pc cd93faea cpsr 600b0030 2018-10-19 09:17:47.439 12666-12666/? A/DEBUG: backtrace: 2018-10-19 09:17:47.439 12666-12666/? A/DEBUG: #00 pc 00172aea /data/app/com.arize.app-2XZKYjS9y_5EtEEGPahwbg==/lib/arm/libviro_renderer.so (_Z14mapinfo_createi+113) 2018-10-19 09:17:47.439 12666-12666/? A/DEBUG: #01 pc 001728e1 /data/app/com.arize.app-2XZKYjS9y_5EtEEGPahwbg==/lib/arm/libviro_renderer.so (_ZN22DebugStacktracePrivateC2Ei+8) 2018-10-19 09:17:47.439 12666-12666/? A/DEBUG: #02 pc 001728bf /data/app/com.arize.app-2XZKYjS9y_5EtEEGPahwbg==/lib/arm/libviro_renderer.so (_ZN15DebugStacktraceC2Ev+22) 2018-10-19 09:17:47.439 12666-12666/? A/DEBUG: #03 pc 00172977 /data/app/com.arize.app-2XZKYjS9y_5EtEEGPahwbg==/lib/arm/libviro_renderer.so (_ZN15DebugStacktrace11getInstanceEv+34) 2018-10-19 09:17:47.439 12666-12666/? A/DEBUG: #04 pc 001eeaed /data/app/com.arize.app-2XZKYjS9y_5EtEEGPahwbg==/lib/arm/libviro_renderer.so (_Z6pstackv+4) 2018-10-19 09:17:47.439 12666-12666/? A/DEBUG: #05 pc 001eeb79 /data/app/com.arize.app-2XZKYjS9y_5EtEEGPahwbg==/lib/arm/libviro_renderer.so 2018-10-19 09:17:47.439 12666-12666/? A/DEBUG: #06 pc 001eec45 /data/app/com.arize.app-2XZKYjS9y_5EtEEGPahwbg==/lib/arm/libviro_renderer.so (_Z7_pabortPKciS0_S0_z+52) 2018-10-19 09:17:47.439 12666-12666/? A/DEBUG: #07 pc 001fe73d /data/app/com.arize.app-2XZKYjS9y_5EtEEGPahwbg==/lib/arm/libviro_renderer.so (_Z9getJNIEnvPP7_JNIEnv+76) 2018-10-19 09:17:47.439 12666-12666/? A/DEBUG: #08 pc 001fea27 /data/app/com.arize.app-2XZKYjS9y_5EtEEGPahwbg==/lib/arm/libviro_renderer.so (_Z20VROPlatformGetJNIEnvv+18) 2018-10-19 09:17:47.439 12666-12666/? A/DEBUG: #09 pc 001bd247 /data/app/com.arize.app-2XZKYjS9y_5EtEEGPahwbg==/lib/arm/libviro_renderer.so (_ZNSt14shared_countILN9__gnu_cxx12_Lock_policyE2EEC2I18VROLazyMaterialJNISaIS4_EJRP8_jobjectEEESt19_Sp_make_shared_tagPT_RKT0DpOT1+62) 2018-10-19 09:17:47.439 12666-12666/? A/DEBUG: #10 pc 001bd1db /data/app/com.arize.app-2XZKYjS9y_5EtEEGPahwbg==/lib/arm/libviro_renderer.so (_ZNSt12shared_ptrI18VROLazyMaterialJNILN9__gnu_cxx12_Lock_policyE2EEC2ISaIS0_EJRP8_jobjectEEESt19_Sp_make_shared_tagRKTDpOT0+26) 2018-10-19 09:17:47.440 12666-12666/? A/DEBUG: #11 pc 001bd0d1 /data/app/com.arize.app-2XZKYjS9y_5EtEEGPahwbg==/lib/arm/libviro_renderer.so (Java_com_viro_core_internal_LazyMaterial_nativeCreateLazyMaterial+24) 2018-10-19 09:17:47.440 12666-12666/? A/DEBUG: #12 pc 00052fbb /data/app/com.arize.app-2XZKYjS9y_5EtEEGPahwbg==/oat/arm/base.odex (offset 0x33000) 2018-10-19 09:17:49.004 3333-3333/? E//system/bin/tombstoned: Tombstone written to: /data/tombstones//tombstone_04

VikAdvani commented 5 years ago

Hi @finnpetersen,

I was able to reproduce this crash. Can you try defining the animations in your componentDidMount method of the class like the following:

componentDidMount() {
    ViroAnimations.registerAnimations({
    loopOne: {
      properties: {
        scaleX:"+=0.2",
        scaleY:"+=0.2",
        scaleZ:"+=0.2",
        material: "white",
      },
      easing: "linear",
      duration: 500
    },
    loopTwo: {
      properties: {
        scaleX:"-=0.2",
        scaleY:"-=0.2",
        scaleZ:"-=0.2",
        material: "red",
      },
      easing: "linear",
      duration: 500
    },
    animatePipe: [["loopOne", "loopTwo"]],
    });
  },

It seems like there might be race condition of the material not being ready before the animation loads. Let us know if that helps. Thanks!

finnpetersen commented 5 years ago

Hi @VikAdvani, thanks for your answer, it kinda helped, the app doesn't crash anymore but the materials aren't applied sadly

VikAdvani commented 5 years ago

Hi @finnpetersen, got it. We filed this bug in our backlog so we can fix it in an upcoming release.