Giphy / giphy-ios-sdk

Home of the GIPHY SDK iOS example app, along with iOS SDK documentation, issue tracking, & release notes.
https://developers.giphy.com/
Mozilla Public License 2.0
116 stars 52 forks source link

[Crash] Attempting to address object pointer with invalid tag #252

Closed xmollv closed 1 month ago

xmollv commented 3 months ago

🐛 Bug Report

We've been observing a crash, but we're not very clear on why it happens. The crash is the following:

SIGTRAP : Attempting to address object pointer with invalid tag
Queue 7645: com.gphpersistence.saveQueue

Thread 11 Queue 7645: com.gphpersistence.saveQueue (serial) [Crashed]:

0    CoreFoundation                           0x19d32014c     CFGetTypeID.cold.1 + 16
1    CoreFoundation                           0x19d180e58     CFGetTypeID + 239
2    CoreFoundation                           0x19d1c2420     __CFPropertyListIsValidAux + 59
3    CoreFoundation                           0x19d1e4694     CFPropertyListWrite + 91
4    CoreFoundation                           0x19d1e439c     CFPropertyListCreateData + 143
5    Foundation                               0x19c0ed74c     +[NSPropertyListSerialization dataWithPropertyList:format:options:error:] + 51
6    GiphyUISDK                               0x1047c1b44     0x10473c000
7    GiphyUISDK                               0x10475baa0     0x10473c000
8    libdispatch.dylib                        0x1a509013c     _dispatch_call_block_and_release + 31
9    libdispatch.dylib                        0x1a5091dd4     _dispatch_client_callout + 19
10   libdispatch.dylib                        0x1a5099400     _dispatch_lane_serial_drain + 747
11   libdispatch.dylib                        0x1a5099f30     _dispatch_lane_invoke + 379
12   libdispatch.dylib                        0x1a50a4cb4     _dispatch_root_queue_drain_deferred_wlh + 287
13   libdispatch.dylib                        0x1a50a4528     _dispatch_workloop_worker_thread + 403
14   libsystem_pthread.dylib                  0x1fa043934     _pthread_wqthread + 287
15   libsystem_pthread.dylib                  0x1fa0400cc     start_wqthread + 7

I can't get you the symbolicated crash logs because we have the GiphySDK as a dependency to an internal SPM package, and apparently there's a limitation on SPM <> Xcode where the dSYMs are not generated if the SPM package is not explicitly defined as .dynamic, which we can't change at this very moment (I understand that this is far from ideal). See:

To Reproduce

Unknown, but seems related to serializing the last used gifs to be displayed later on. It seems to happen right once the user selects a GIF and we receive the GiphyDelegate callback GiphyDelegate.didSelectMedia(giphyViewController:media:).

Screenshot 2024-08-05 at 10 25 08 Screenshot 2024-08-05 at 10 25 29

Expected behavior

SDK doesn't crash.

Actual Behavior

Sometimes the SDK does crash.

Your Environment

Reproducible Demo

N/A

leschlogl commented 3 months ago

Hey @xmollv,

Thank you for flagging this. We'll look into it and get back to you soon.

msrutek-paylocity commented 2 months ago

Hello @leschlogl any update on this? We're seeing the same crash.

leschlogl commented 2 months ago

Hi @msrutek-paylocity and @xmollv,

We were able to reproduce and fix the issue. It should be included in the next release. It should be released this or in the next week.

leschlogl commented 2 months ago

Hello!

We just released v2.2.11 that addresses this issue.

Please, let us know if everything is okay so we can close this issue!

Thank you!

msrutek-paylocity commented 2 months ago

@leschlogl trying to update to the 2.2.11 version, we get these errors.

Cannot find type 'SwiftUICore' in scope Failed to build module 'GiphyUISDK'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 6.0 effective-5.10 (swiftlang-6.0.0.9.10 clang-1600.0.26.2)', while this compiler is 'Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)'). Please select a toolchain which matches the SDK. Command SwiftCompile failed with a nonzero exit code

Has the SDK been built with a newer Swift version? This feels like a breaking change 🤔

xmollv commented 2 months ago

Hello!

We just released v2.2.11 that addresses this issue.

Please, let us know if everything is okay so we can close this issue!

Thank you!

We release weekly, so on next Monday it'll go live the version that contains the upgraded version of the Giphy SDK. If the crash still happens I'll let you know again! Thanks for the fix 🙏🏼

@leschlogl trying to update to the 2.2.11 version, we get these errors.

Cannot find type 'SwiftUICore' in scope Failed to build module 'GiphyUISDK'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 6.0 effective-5.10 (swiftlang-6.0.0.9.10 clang-1600.0.26.2)', while this compiler is 'Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)'). Please select a toolchain which matches the SDK. Command SwiftCompile failed with a nonzero exit code

Has the SDK been built with a newer Swift version? This feels like a breaking change 🤔

I've upgraded to it and it seems to be compiling fine for me! I'm on Xcode 16 tho (still on Swift 5, not upgraded to 6 yet).

msrutek-paylocity commented 2 months ago

I'm on Xcode 16 tho (still on Swift 5, not upgraded to 6 yet).

We're still using Xcode 15.4

leschlogl commented 1 month ago

Hi @msrutek-paylocity

Thanks for letting us know and I apologise for that.

We released v2.2.12 that is Xcode 15 compatible.

Thank you!

msrutek-paylocity commented 1 month ago

@leschlogl thank you, 2.2.12 works ✅ ... I guess this issue can be closed then :)