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

Fix crash in withCheckedContinuation on iOS 18.0 #46

Merged
merged 1 commit into from
Sep 25, 2024

Conversation

leoMehlig
Copy link
Contributor

Describe the purpose of your pull request

I've seen crashes on iOS 18.0 in our iOS app in the code of this SDK. The crash seems to be the same as in other SDKs, that use withCheckedContinuation, which is actually a bug in iOS 18.0 (apparently fixed on iOS 18.1).

The easy fix for the crash is to use withUnsafeContinuation instead, which only has the downside of no longer checking (and logging) if the continuation is not continued/finished.

This PR applies this fixed everywhere in the SDK to hopefully resolve this issue.

Crash Log:


Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000004
Exception Codes: 0x0000000000000001, 0x0000000000000004
VM Region Info: 0x4 is not in any region.  Bytes before following region: 4371005436
      REGION TYPE                 START - END      [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  
      __TEXT                   104884000-104b4c000 [ 2848K] r-x/r-x SM=COW  /var/containers/Bundle/Application/19708210-5A4F-4157-9ED0-E2EB9CCCEBB5/Structured.app/Structured
Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [6285]
...
Thread 2:
0   Structured                    	0x00000001050597d0 specialized withCheckedContinuation<A>(isolation:function:_:) + 8 (/<compiler-generated>:0)
1   Structured                    	0x00000001050597d0 ConfigCatClient.waitForReady() + 88
2   Structured                    	0x00000001050597d0 0x104884000 + 8214480 (ConfigCatClient.swift:354)
3   Structured                    	0x0000000104ee21fd closure #1 in TelemetryTracker.launched(properties:) + 1 (Telemetry.swift:117)
4   Structured                    	0x000000010495da09 $sxIeAgHr_xs5Error_pIegHrzo_s8SendableRzlTRyt_Tg5TATQ0_ + 1
5   Structured                    	0x00000001049587d1 thunk for @escaping @callee_guaranteed @async () -> () + 1 (/<compiler-generated>:0)
6   Structured                    	0x0000000104959d71 partial apply for closure #1 in CycleSeasonsManager.observeToggle() + 1 (/<compiler-generated>:0)
7   libswift_Concurrency.dylib    	0x000000018fc5c689 completeTaskWithClosure(swift::AsyncContext*, swift::SwiftError*) + 1 (Task.cpp:471)

Related issues (only if applicable)

Provide links to issues relating to this pull request

Requirement checklist (only if applicable)

  • I have covered the applied changes with automated tests.
  • I have executed the full automated test set against my changes.
  • I have validated my changes against all supported platform versions.
  • I have read and accepted the contribution agreement.

@leoMehlig leoMehlig requested a review from a team as a code owner September 25, 2024 08:29
@z4kn4fein
Copy link
Member

Thank you for bringing this to our attention! I'll prepare a new release with this soon.

@z4kn4fein z4kn4fein merged commit cf33276 into configcat:master Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants