Sporadic Dyld crashes

Our app is seeing sporadic crashes on launch when using dynamic libraries. This is only when running the app store release on device.


We are using CocaPods, which seems to be the cause of this issue for other developers, but we aren't seeing it 100% of the time that we run. It's probably less than a tenth of a percent. We've randomly had one user at our office have it occur and grabbed his crash logs. Every time he tries to launch the app it crashes, but for some reason if he enters the app from a push notification it launches fine!


For example:


Dyld Error Message:
Dyld Message: Library not loaded: @rpath/MoPub.framework/MoPub
  Referenced from: /var/mobile/Containers/Bundle/Application/5D64892C-E1A7-4BCE-9154-E28B397C7258/<AppName>.app/<AppName>
  Reason: no suitable image found.  Did find:
  /private/var/mobile/Containers/Bundle/Application/5D64892C-E1A7-4BCE-9154-E28B397C7258/<AppName>.app/Frameworks/MoPub.framework/MoPub: mremap_encrypted() => -1, errno=12 for /private/var/mobile/Containers/Bundle/Application/5D64892C-E1A7-4BCE-9154-E28B397C7258/<AppName>.app/Frameworks/MoPub.framework/MoPub


  /private/var/mobile/Containers/Bundle/Application/5D64892C-E1A7-4BCE-9154-E28B397C7258/<AppName>.app/Frameworks/MoPub.framework/MoPub: mremap_encrypted() => -1, errno=12 for /private/var/mobile/Containers/Bundle/Application/5D64892C-E1A7-4BCE-9154-E28B397C7258/<AppName>.app/Frameworks/MoPub.framework/MoPub


  /private/var/mobile/Containers/Bundle/Application/5D64892C-E1A7-4BCE-9154-E28B397C7258/<AppName>.app/Frameworks/MoPub.framework/MoPub: mremap_encrypted() => -1, errno=12 for /private/var/mobil
  Dyld Version: 370.6


(App name obfuscated as <AppName>)


Any idea why this would be happening only some of the time?

Replies

I do not believe it has to do with CocoaPods, but a matter of running out of memory and iOS not really dealing with this in a great way.


I did a write-up of the issue on our app’s repo: https://github.com/artsy/eigen/issues/1246

Saw this error when installing an app having a dylib inside a framework.

I'm using iPad5,1 with iPhone OS 13.5.1

Also repros on iPhone6 with iPhone OS 13.6. Stack trace on iPhone6

Code Block
Thread 0 Crashed:
0 dyld 0x00000001051d4f68 __abort_with_payload + 8
1 dyld 0x00000001051dbee8 abort_with_payload_wrapper_internal + 100 (terminate_with_reason.c:102)
2 dyld 0x00000001051dbf18 abort_with_payload + 12 (terminate_with_reason.c:124)
3 dyld 0x00000001051d913c dyld::halt(char const*) + 384 (dyld2.cpp:4240)
4 dyld 0x000000010518f1a4 dyld::_main(macho_header const*, unsigned long, int, char const, char const, char const**, unsigned long*) + 5156 (dyld2.cpp:7031)
5 dyld 0x0000000105189208 dyldbootstrap::start(dyld3::MachOLoaded const*, int, char const**, dyld3::MachOLoaded const*, unsigned long*) + 396 (dyldInitialization.cpp:145)
6 dyld 0x0000000105189038 _dyld_start + 56