Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash in Swift6 when calling GiphyCore.shared.gifByID(giphyId) #265

Closed
rckoenes opened this issue Jan 23, 2025 · 6 comments · Fixed by #273
Closed

Crash in Swift6 when calling GiphyCore.shared.gifByID(giphyId) #265

rckoenes opened this issue Jan 23, 2025 · 6 comments · Fixed by #273
Labels
bug Something isn't working

Comments

@rckoenes
Copy link

🐛 Bug Report

Using 2.2.13 the app crash after calling: GiphyCore.shared.gifByID(giphyId)

To Reproduce

Just call GiphyCore.shared.gifByID(giphyId)

Expected behavior

That the app will not crash

Actual Behavior

The app crashes.

Here ios the back trace:

* thread #6, queue = 'com.apple.NSURLSession-delegate', stop reason = EXC_BREAKPOINT (code=1, subcode=0x1003d8214)
  * frame #0: 0x00000001003d8214 libdispatch.dylib`_dispatch_assert_queue_fail + 116
    frame #1: 0x00000001003d81a0 libdispatch.dylib`dispatch_assert_queue + 188
    frame #2: 0x00000002493a0400 libswift_Concurrency.dylib`swift_task_isCurrentExecutorImpl(swift::SerialExecutorRef) + 284
    frame #3: 0x00000001047b98b8 TestServer1.debug.dylib`closure #1 in GiphyViewModel.load(response=0x000060000037ec20, error=nil) at GiphyViewModel.swift:0
    frame #4: 0x0000000101464bac GiphyUISDK`___lldb_unnamed_symbol7365 + 416
    frame #5: 0x0000000101464dd8 GiphyUISDK`___lldb_unnamed_symbol7367 + 52
    frame #6: 0x000000010146b0a8 GiphyUISDK`___lldb_unnamed_symbol7530 + 268
    frame #7: 0x000000010146bb20 GiphyUISDK`___lldb_unnamed_symbol7535 + 1412
    frame #8: 0x000000010146962c GiphyUISDK`___lldb_unnamed_symbol7502 + 144
    frame #9: 0x0000000184802a48 CFNetwork`__40-[__NSURLSessionLocal taskForClassInfo:]_block_invoke + 500
    frame #10: 0x0000000184819abc CFNetwork`__49-[__NSCFLocalSessionTask _task_onqueue_didFinish]_block_invoke_2 + 152
    frame #11: 0x00000001003d4cd8 libdispatch.dylib`_dispatch_call_block_and_release + 24
    frame #12: 0x00000001003d65d0 libdispatch.dylib`_dispatch_client_callout + 16
    frame #13: 0x00000001003de8b8 libdispatch.dylib`_dispatch_lane_serial_drain + 896
    frame #14: 0x00000001003df628 libdispatch.dylib`_dispatch_lane_invoke + 420
    frame #15: 0x00000001003ec2cc libdispatch.dylib`_dispatch_root_queue_drain_deferred_wlh + 324
    frame #16: 0x00000001003eb838 libdispatch.dylib`_dispatch_workloop_worker_thread + 732
    frame #17: 0x000000010046fb74 libsystem_pthread.dylib`_pthread_wqthread + 284

Your Environment

  • Giphy iOS SDK version: 2.2.13
  • Dependency Manager: SPM
  • Xcode Version: 16.2
  • Swift Version: 6
  • Device info Simulator iOS 18.2

Reproducible Demo

Swift6 project that show the crash.

@rckoenes rckoenes added the bug Something isn't working label Jan 23, 2025
@ALexanderLonsky
Copy link
Collaborator

Hey @rckoenes,
Thanks for flagging this issue!
We've identified the issue and resolved it, the fix will be included in the next release

@ALexanderLonsky ALexanderLonsky linked a pull request Feb 10, 2025 that will close this issue
@ALexanderLonsky
Copy link
Collaborator

@rckoenes
The issue has been addressed in this release.
Could you please try it on your end?

@rckoenes
Copy link
Author

@ALexanderLonsky great work, it now works as expected.

@jayelzaghmoutt
Copy link

jayelzaghmoutt commented Feb 13, 2025

Hi,

We are using 2.2.14 and we still getting the same crash:

Crashed: com.apple.main-thread
0  libdispatch.dylib              0x13b5c __DISPATCH_WAIT_FOR_QUEUE__ + 484
1  libdispatch.dylib              0x13694 _dispatch_sync_f_slow + 148
2  Our App                     0x1155bc0 closure #2 in CommunicationConversationMessageTableViewCell.setupMediaStackView(imageRepresentables:videosRepresentables:attachementRepresentables:gifAttachment:showOverLayView:) + 233 (CommunicationConversationMessageTableViewCell.swift:233)
3  Our App                     0xcb56ec closure #1 in UIImageView.loadGIFById(id:completion:) + 45 (UIImageView+Extension.swift:45)
4  Our App                     0x1bc9f0 closure #1 in HarriGIPHYManager.loadGIFById(id:imageViewIdentifier:uuid:completion:) + 67 (HarriGIPHYManager.swift:67)
5  Our App                     0xf71390 partial apply for closure #1 in HarriGIPHYManager.loadGIFById(id:imageViewIdentifier:uuid:completion:) + 4385198992 (<compiler-generated>:4385198992)
6  GiphyUISDK                     0x89d00 GiphyUISDKVersion + 506892
7  GiphyUISDK                     0x89f34 GiphyUISDKVersion + 507456
8  GiphyUISDK                     0xcd4a8 GiphyUISDKVersion + 783284
9  GiphyUISDK                     0x11eb4 GiphyUISDKVersion + 15808
10 libdispatch.dylib              0x2248 _dispatch_call_block_and_release + 32
11 libdispatch.dylib              0x3fa8 _dispatch_client_callout + 20
12 libdispatch.dylib              0x12a34 _dispatch_main_queue_drain + 984
13 libdispatch.dylib              0x1264c _dispatch_main_queue_callback_4CF + 44
14 CoreFoundation                 0x79bcc __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
15 CoreFoundation                 0x761c0 __CFRunLoopRun + 1996
16 CoreFoundation                 0xc8284 CFRunLoopRunSpecific + 588
17 GraphicsServices               0x14c0 GSEventRunModal + 164
18 UIKitCore                      0x3ee674 -[UIApplication _run] + 816
19 UIKitCore                      0x14e88 UIApplicationMain + 340
20 Our App                     0x199a0 main + 17 (AppDelegate.swift:17)
21 ???                            0x1ac2e1de8 (Missing)

@rckoenes
Copy link
Author

Hi,

We are using 2.2.14 and we still getting the same crash:

Crashed: com.apple.main-thread

Seem to be a different one, this is not in NSURLSession.

@Tom3652
Copy link

Tom3652 commented Feb 13, 2025

Hey @ALexanderLonsky it seems that 2.2.14 has introduced a new crash at 100% reproductible on DispatchQueue.main.sync :

func getMedia(id: String, completion: ((String?) -> Void)? = nil) {
    GiphyCore.shared.gifByID(id) { (response, error) in
        if let media = response?.data {
            DispatchQueue.main.sync { [weak self] in       # This line is crashing 
                let url = media.url(rendition: .fixedWidth, fileType: .gif)
                completion?(url)
            }
        }
        else {
            completion?(nil)
        }
    }
}

Rolling back to 2.2.13 fixes the crash.

My app actually doesn't crash at all in 2.2.13 calling the above code so i will keep it for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants