joltup / react-native-threads

Create new JS processes for CPU intensive work
MIT License
755 stars 141 forks source link

iOS crashing on new thread (RNN) #73

Closed lukefanning closed 5 years ago

lukefanning commented 5 years ago

I am seeing the error This application is modifying the autolayout engine from a background thread after the engine was accessed from the main thread. This can lead to engine corruption and weird crashes. multiple times on iOS when creating a new thread. Android is working perfectly.

This is then followed by *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'This method must not be called before the JS thread is created' and then a hard crash.

I am using React Native Navigation 2.16.0, React Native 0.59.2.

My suspicion is this module does not play well with RNN on iOS.

lukefanning commented 5 years ago

Yeah I just tried your SimpleExample and added latest RNN to it. It started to go into a reload JS loop constantly trying to start up the worker thread script. Copy pasted a section of the log from XCode here https://pastebin.com/ayTQUCZa

lukefanning commented 5 years ago

Solved it. Have to make sure that Navigation.setRoot() is only ever called once inside Navigation.events().registerAppLaunchedListener()