SRGSSR / srgletterbox-apple

The official SRG SSR media playback experience
https://srgssr.github.io/marketing/letterbox/
MIT License
14 stars 7 forks source link

Symbolication issues #238

Closed defagos closed 3 years ago

defagos commented 3 years ago

Recent releases of Play SRF or SRF Sports have crash reports omitting part of the stack trace:

Last Exception Backtrace:
0   CoreFoundation                  0x1839fd9d4 __exceptionPreprocess + 216 (NSException.m:199)
1   libobjc.A.dylib                 0x1973aeb54 objc_exception_throw + 56 (objc-exception.mm:565)
2   CoreFoundation                  0x18390c4fc +[NSException raise:format:arguments:] + 96 (NSException.m:146)
3   Foundation                      0x184c04878 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 128 (NSException.m:231)
4   SRF Sport App                   0x1025d14a8 _hidden#849_ + 1088 (__hidden#1268_:1692)
5   SRF Sport App                   0x1025ce4bc _hidden#823_ + 1272 (__hidden#1268_:1332)
6   SRF Sport App                   0x1025ccb98 _hidden#798_ + 520 (__hidden#1268_:1060)
7   SRF Sport App                   0x1025c6cd0 _hidden#717_ + 32 (__hidden#1268_:154)
8   SRF Sport App                   0x1025e6040 __55-[MAKVONotificationCenter _swizzleObjectClassIfNeeded:]_block_invoke + 308 (MAKVONotificationCenter.m:346)
9   SRF Sport App                   0x10259a0ec _hidden#1254_ + 336 (__hidden#1484_:202)
10  libobjc.A.dylib                 0x1973adae0 object_cxxDestructFromClass(objc_object*, objc_class*) + 112 (objc-class.mm:455)
11  libobjc.A.dylib                 0x1973c38a4 objc_destructInstance + 88 (objc-class.mm:469)
12  libobjc.A.dylib                 0x1973ca6ec _objc_rootDealloc + 52 (objc-runtime-new.mm:8131)
13  SRF Sport App                   0x10258fca4 _hidden#1043_ + 164 (__hidden#1484_:283)
14  SRF Sport App                   0x1025e6040 __55-[MAKVONotificationCenter _swizzleObjectClassIfNeeded:]_block_invoke + 308 (MAKVONotificationCenter.m:346)
15  libsystem_blocks.dylib          0x1ca021784 _Block_release + 188 (runtime.cpp:176)
16  libsystem_blocks.dylib          0x1ca021784 _Block_release + 188 (runtime.cpp:176)
17  SRF Sport App                   0x1025f2ef4 _hidden#77_ + 40 (__hidden#140_:30)
...

instead of something more explicit (here the same crash in an old Play version, not obtained via symbolication of a recent crash log of course since this does not work):

0   CoreFoundation                      0x000000010e42aaf2 __exceptionPreprocess + 242
1   libobjc.A.dylib                     0x000000010e2bae78 objc_exception_throw + 48
2   CoreFoundation                      0x000000010e42a91b +[NSException raise:format:] + 0
3   Foundation                          0x000000010db9756a -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191
4   SRGLetterboxTests                   0x000000012cb7d3a6 -[SRGMediaPlayerController updateTracksForPlayer:] + 214
5   SRGLetterboxTests                   0x000000012cb787e9 -[SRGMediaPlayerController stopWithUserInfo:] + 2313
6   SRGLetterboxTests                   0x000000012cb7568d -[SRGMediaPlayerController reset] + 685
7   SRGLetterboxTests                   0x000000012cb68a64 -[SRGMediaPlayerController dealloc] + 36
8   SRGLetterboxTests                   0x000000012cba9296 __55-[MAKVONotificationCenter _swizzleObjectClassIfNeeded:]_block_invoke + 598
9   libobjc.A.dylib                     0x000000010e2d2834 _ZN11objc_object17sidetable_releaseEbb + 174
10  SRGLetterboxTests                   0x000000012cc9c4d3 -[SRGLetterboxController .cxx_destruct] + 643
11  libobjc.A.dylib                     0x000000010e2ba0f0 _ZL27object_cxxDestructFromClassP11objc_objectP10objc_class + 83
12  libobjc.A.dylib                     0x000000010e2cbf11 objc_destructInstance + 64
13  libobjc.A.dylib                     0x000000010e2d1fb8 -[NSObject dealloc] + 21
14  SRGLetterboxTests                   0x000000012cc8ab73 -[SRGLetterboxController dealloc] + 195
15  libobjc.A.dylib                     0x000000010e2d2834 _ZN11objc_object17sidetable_releaseEbb + 174
16  SRGLetterboxTests                   0x000000012cc89111 __destroy_helper_block_e8_32s40s + 65
17  libsystem_blocks.dylib              0x00000001106bf42f _Block_release + 128

Normally the bcsymbolmap should take care of turning _hidden stuff into readable symbols, but in this case it does not.

I archived Play SRF again with Xcode 12.2 and checked the bcsymbolmap. It already contains hidden symbols, which explains why those are still hidden in the final output. The bitcode symbol map is simply incomplete.

This issue might be related to SPM, as this post suggests. The same person posted a message on the Swift forums but received no answer.

defagos commented 3 years ago

Also easy to reproduce with SRG Media Player demo. Therefore I suggest we proceed as follows:

  1. Check with latest Xcode 12.3 beta first. If fixed, stop there.
  2. Create a sample project with a framework target and export an archive. Check the bcsymbolmap. The framework should implement a class and a method whose implementation throws an exception.
  3. Do the same with a Swift package.

If bcsymbolmap is complete for 2 but not for 3, check whether there is a setting which can fix the issue. Make both apps crash on a device and collect the symbolicated crash reports in the organizer as proofs.

If a bug is found open a dedicated report.

defagos commented 3 years ago

bcsymbolmap not better with Xcode 12.3 beta 1.

defagos commented 3 years ago

The symbolication issue itself is an SPM 5.3 bug, affecting all packages containing resources. I opened a bug report: https://openradar.appspot.com/radar?id=5030814031020032

defagos commented 3 years ago

I also opened a thread on the Swift forums: https://forums.swift.org/t/incomplete-crash-log-symbolication-for-bitcode-enabled-apps-linked-with-packages-containing-resources/42696/2

pyby commented 3 years ago

After a comment in the Swift forums, I tested with Xcode 12.5 beta 1 and it's really better. 👍