Open cristianoccazinsp opened 5 years ago
The API key does not require an internet connection. The API key is a soft check, so the renderer will keep running if it’s offline and only fails if the key is proven to be invalid. If your device is offline and we can’t validate the key we allow the app to continue to run.
It doesn't look like that to me right now. It did work offline after I had it connected once. But after a few restarts, the app freezes and the logcat just prints reconnect attempts. The app ends up crashing after a while. And with freezing I mean it blocks the UI thread or react bridge and no JS runs.
That's strange, could you share: 1 - Code sample you were testing with to verify the crash. 2 - Repro steps you took for it to crash. 3 - React native + Viro React version you are using, and as well as the device and model number. 4 - Crash logs if possible.
Can't share the whole code, but here are the important sections, I believe it is well self explanatory. NOTE: Some times it doesn't freeze/crash, still trying to pinpoint the exact cause. Looking at the log might be related to OOM, but I don't see a reason for it to oom this fast.
Basically, the library is overkill for what I'm trying to achieve, which is just showing a 360 picture in a modal.
function GetViroScene(props){
return (
<ViroScene>
<Viro360Image
source={{uri: 'https://zinspectordev2.s3.amazonaws.com/usi/211/1555523982eac3d0c0520748118800cddd5a043053.JPEG'}} //props.uri}} //}}
/>
</ViroScene>
)
}
modalViewer = (
<ViroVRSceneNavigator
apiKey={conf.VIRO_API_KEY}
vrModeEnabled={false}
initialScene={{ scene: GetViroScene }}
passProps={{uri: this.state.modalVisible.uri}}
/>
)
<Modal
animationType="slide"
transparent={true}
visible={this.state.modalVisible != null}
onRequestClose={this.closeModal}
supportedOrientations={['portrait', 'landscape']}
>
<View style={{backgroundColor: 'rgba(0,0,0, 0.9)', flex:1}}>
<Button
onPress={this.closeModal}
style={{position: 'absolute', top: MODAL_TOP, left: 5, zIndex: 100}}
transparent
light
rounded
>
<Icon name='close' type='AntDesign'></Icon>
</Button>
<Button
onPress={() => this.state.modalConfirmDelete ? this.onDelete(this.state.modalVisible, true) : this.setState({modalConfirmDelete: true})}
style={{position: 'absolute', top: MODAL_TOP, right: 5, zIndex: 100}}
transparent
light
rounded
>
{!this.state.modalConfirmDelete ? <Icon name='delete' type='AntDesign'></Icon> : <Text danger>Delete?</Text>}
</Button>
{ modalViewer }
</View>
</Modal>
05-02 20:43:35.017 4564-5179/com.zinspector_rn I/Viro: Attempt #3 to fetch api keys failed. Retrying in 8000 milliseconds
05-02 20:43:36.129 4564-5310/com.zinspector_rn I/Viro: Attempt #3 to fetch api keys failed. Retrying in 8000 milliseconds
05-02 20:43:46.556 4564-4564/com.zinspector_rn D/vndksupport: Loading /vendor/lib/hw/android.hardware.memtrack@1.0-impl.so from current namespace instead of sphal namespace.
05-02 20:43:46.565 4564-4564/com.zinspector_rn D/vndksupport: Loading /vendor/lib/hw/memtrack.msm8937.so from current namespace instead of sphal namespace.
memtrack_open: exit 0
05-02 20:43:46.570 4564-4564/com.zinspector_rn W/m.zinspector_rn: type=1400 audit(0.0:6511): avc: denied { read } for uid=10198 name="mem" dev="debugfs" ino=13413733 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:kgsl_debugfs:s0 tclass=file permissive=0
05-02 20:43:46.906 4564-4564/com.zinspector_rn I/chatty: uid=10198(com.zinspector_rn) identical 2 lines
05-02 20:43:46.906 4564-4564/com.zinspector_rn W/m.zinspector_rn: type=1400 audit(0.0:6514): avc: denied { read } for uid=10198 name="mem" dev="debugfs" ino=13413733 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:kgsl_debugfs:s0 tclass=file permissive=0
05-02 20:43:46.911 4564-4564/com.zinspector_rn I/Choreographer: Skipped 43 frames! The application may be doing too much work on its main thread.
05-02 20:43:47.243 4564-4564/com.zinspector_rn W/m.zinspector_rn: type=1400 audit(0.0:6515): avc: denied { read } for uid=10198 name="mem" dev="debugfs" ino=13413733 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:kgsl_debugfs:s0 tclass=file permissive=0
05-02 20:43:47.590 4564-4564/com.zinspector_rn W/m.zinspector_rn: type=1400 audit(0.0:6517): avc: denied { read } for uid=10198 name="mem" dev="debugfs" ino=13413733 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:kgsl_debugfs:s0 tclass=file permissive=0
05-02 20:43:47.593 4564-4564/com.zinspector_rn I/Choreographer: Skipped 40 frames! The application may be doing too much work on its main thread.
05-02 20:43:50.073 4564-4564/com.zinspector_rn W/m.zinspector_rn: type=1400 audit(0.0:6519): avc: denied { read } for uid=10198 name="mem" dev="debugfs" ino=13413733 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:kgsl_debugfs:s0 tclass=file permissive=0
05-02 20:43:50.073 4564-4564/com.zinspector_rn W/m.zinspector_rn: type=1400 audit(0.0:6520): avc: denied { read } for uid=10198 name="mem" dev="debugfs" ino=13413733 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:kgsl_debugfs:s0 tclass=file permissive=0
05-02 20:43:50.416 4564-4564/com.zinspector_rn W/m.zinspector_rn: type=1400 audit(0.0:6521): avc: denied { read } for uid=10198 name="mem" dev="debugfs" ino=13413733 scontext=u:r:untrusted_app:s0:c512,c768 tcontext=u:object_r:kgsl_debugfs:s0 tclass=file permissive=0
05-02 20:43:50.434 4564-4564/com.zinspector_rn I/Choreographer: Skipped 44 frames! The application may be doing too much work on its main thread.
05-02 20:44:05.865 4564-4655/com.zinspector_rn W/cr_ChildProcessConn: onServiceDisconnected (crash or killed by oom): pid=0
Device: Motorola G5, Android 8.1
"dependencies": {
"@react-native-community/netinfo": "2.0.8",
"async-mutex": "0.1.3",
"moment": "2.24.0",
"native-base": "2.12.1",
"prop-types": "15.7.2",
"react": "16.8.6",
"react-native": "^0.59.5",
"react-native-background-fetch": "2.5.4",
"react-native-base64": "0.0.2",
"react-native-camera": "2.6.0",
"react-native-color-palette": "2.0.3",
"react-native-device-info": "1.6.1",
"react-native-easy-grid": "0.2.1",
"react-native-gesture-handler": "1.2.1",
"react-native-image-pan-zoom": "2.1.11",
"react-native-image-resizer": "1.0.1",
"react-native-keep-awake": "4.0.0",
"react-native-loading-spinner-overlay": "1.0.1",
"react-native-mime-types": "2.2.1",
"react-native-modal-filter-picker": "1.3.4",
"react-native-push-notification": "3.1.3",
"react-native-share": "^1.1.3",
"react-native-uuid-generator": "5.0.0",
"react-native-video": "4.4.1",
"react-native-vitals": "^1.0.2",
"react-navigation": "3.9.1",
"react-redux": "7.0.3",
"react-viro": "^2.14.0",
"realm": "2.26.1",
"redux": "4.0.1",
"redux-logger": "3.0.6",
"redux-persist": "5.10.0",
"redux-persist-filesystem-storage": "1.3.2",
"redux-thunk": "2.3.0",
"rn-fetch-blob": "0.10.15",
"underscore": "1.9.1"
}
In addition, those API checks are piling up. If I close and re open the modal (which will re-build the navigator), it will trigger another api check with re-tries. Since I'm using this to open a viewer from a gallery list, this can escalate very quickly.
Interesting, it sounds like you are constantly destroying + re-constructing the renderer as you close and then re-open then modal - this sounds highly costly and in-efficient.
As @dam00n has mentioned, the renderer should work even without an app connection. From the above, it sounds highly likely that you are running into memory issues by re-creating a new renderer for every "re-opening" event.
Especially for 3d rendering applications, you would ideally want to construct the 3d renderer view once, then cache it somewhere (or detach it) in hopes of re-attaching it later to the view tree again. Else, you would want a "lite" renderer version, but we don't currently support that at the moment.
I would suggest using Viro in a way in Modal, or alternative controls, where you are not constantly re-creating / destroying the renderer to mitigate the above issue.
Hmm, you are right about it being inefficient. However, I don't think it should be leaking memory or those network request retries. Is there a better way to achieve what I'm trying with Viro? All I just need is to be able to render 360 pictures, and this library seem to be the only one maintained that links react native and google VR.
Does the API Key require you app to have internet connection? Looks like the whole app crashes if it doesn't.