BITNATION-Pangea-mobile icon indicating copy to clipboard operation
BITNATION-Pangea-mobile copied to clipboard

[ios] App crash on concurrent native modules call

Open seland opened this issue 6 years ago • 1 comments

Feature / Issue

Observation

It was tried to call PanthalassaCall to get contacts and documents on login. Since the calls are driven by sagas, they was called almost at the same time. It turns out into a crash (means the app crash, not a red screen).

Investigation

It was found that arguments on native modules methods are incorrect in the case described above. Specifically, all of them are nil. That cause the crash when trying to call a callback - resolve or reject.

Explanation

It looks like initialization code of RCTModuleMethod is not thread-safe, therefore when we are calling some native method at the same cycle twice (when it's the first call of that method till now) it cause concurrent initialization, which cause some arguments to not be retained correctly, which in turn cause them to be nil.

Acceptance criteria

  • [ ] No crash on concurrent call

Additional information

As a quick workaround we can just call each method one time somewhere at start of the app to be sure that initialization is done.

seland avatar Sep 11 '18 20:09 seland

Related to this issue

seland avatar Sep 12 '18 20:09 seland