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 PhoenixTransport iOS 18 only #267

Open
udaypatial opened this issue Oct 7, 2024 · 13 comments
Open

Crash in PhoenixTransport iOS 18 only #267

udaypatial opened this issue Oct 7, 2024 · 13 comments

Comments

@udaypatial
Copy link

udaypatial commented Oct 7, 2024

Hi we're seeing a number of crashes on crashlytics in PhoenixTransport. Any thoughts?

Crashed: com.apple.NSURLSession-delegate
0  libobjc.A.dylib                0x9260 objc_loadWeakRetained + 180
1  SwiftPhoenixClient             0x121d0 closure #1 in URLSessionTransport.receive() + 294 (PhoenixTransport.swift:294)
2  Foundation                     0x46c294 <redacted> + 200
3  Foundation                     0x46c404 <redacted> + 84
4  libdispatch.dylib              0x2370 _dispatch_call_block_and_release + 32
5  libdispatch.dylib              0x40d0 _dispatch_client_callout + 20
6  libdispatch.dylib              0xb6d8 _dispatch_lane_serial_drain + 744
7  libdispatch.dylib              0xc214 _dispatch_lane_invoke + 432
8  libdispatch.dylib              0x17258 _dispatch_root_queue_drain_deferred_wlh + 288
9  libdispatch.dylib              0x16aa4 _dispatch_workloop_worker_thread + 540
10 libsystem_pthread.dylib        0x4c7c _pthread_wqthread + 288
11 libsystem_pthread.dylib        0x1488 start_wqthread + 8
@udaypatial udaypatial changed the title Crash in PhoenixTransport Crash in PhoenixTransport iOS 18 only Oct 7, 2024
@udaypatial
Copy link
Author

it happens when we background the app. on backgrounding we disconnect the socket connection. it disconnects but crashes.

@udaypatial
Copy link
Author

any idea @davidstump ?

@dsrees
Copy link
Collaborator

dsrees commented Oct 10, 2024

@udaypatial Is it consistently crashing when you background the app? Can you easily reproduce it?

@udaypatial
Copy link
Author

I couldn't reproduce it but crashes quiet consistently on production 10k users affected.

@udaypatial
Copy link
Author

udaypatial commented Oct 10, 2024

the number has increased drastically after we upgraded to the latest version or maybe has something to do with iOS 18

@dsrees
Copy link
Collaborator

dsrees commented Oct 10, 2024

These are kinda hard to track down. I have a couple of pending weak reference changes that I can push a release to and see if that helps your numbers come down.

@dsrees
Copy link
Collaborator

dsrees commented Oct 10, 2024

@udaypatial 5.3.4 is available, if you could give it a try and report back.

upgraded to the latest version

Another option is to rollback to the previous version you were using and see if crashes go away. This would narrow down if it was caused by a previous change or if it is specific to iOS 18.

@udaypatial
Copy link
Author

udaypatial commented Oct 10, 2024

@dsrees thanks i'll try this new version and let you know how it goes.

@pouyayarandi
Copy link

pouyayarandi commented Nov 23, 2024

In this thread, seems CFStream cause crashes in WebSocket.
https://forums.developer.apple.com/forums/thread/769191

Based on the thread, DTS engineer suggests use Network framework instead of CFStream as it's going to be deprecated.

@varun-score
Copy link

Hey @dsrees, since Uday recently left our company, I’ve taken over this work. Despite updating to version 5.3.4, we’re still experiencing a high crash rate. Would you recommend rolling back to an earlier version to see if it resolves the issue? If so, which version would you suggest we roll back to?

@dsrees
Copy link
Collaborator

dsrees commented Nov 27, 2024

In this thread, seems CFStream cause crashes in WebSocket. https://feedbackassistant.apple.com/feedback/15934866

Based on the thread, DTS engineer suggests use Network framework instead of CFStream as it's going to be deprecated.

I'm not able to see any feedback referenced in that link. If you could, could you please copy the relevant snippets?

@pouyayarandi
Copy link

pouyayarandi commented Nov 28, 2024

Sorry @dsrees, the link was wrong. Thread link:
https://forums.developer.apple.com/forums/thread/769191

from thread:

If that’s the case I recommend that you change that code to use Network framework. Using CFSocketStream for networking is no longer a recommended approach. See TN3151 Choosing the right networking API.

@dsrees
Copy link
Collaborator

dsrees commented Nov 28, 2024

Hm, fascinating. According to this documentation, it suggests against using URLSession for new websocket code. Since NWConnection has been available since iOS 12, I can see implementing a transport layer with it.

@varun-score I don't know when I'll get to this. You can try implementing your own in your project and passing it as the Transport in your pocket constructor. You can use URLSessionTransport in the client as an example

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

No branches or pull requests

4 participants