twilio / conversations-ios

SPM releases
https://www.twilio.com/docs/conversations/ios/changelog
10 stars 5 forks source link

App crashes while trying to update twilio token #19

Closed rtavares89 closed 2 years ago

rtavares89 commented 2 years ago

Hi,

I'm facing some crashes when app tries to update Twilio token. This mainly happens when app is in background for 1 or 2 days and when it came back to foreground it crashes after a few seconds. After analysing the issue, we suspect that this is due to while the app is trying to get internet connection, Twilio is trying to update the token without internet connection. While analysing this behaviour I've found out that memory is increasing a lot, as you can see on screenshots, and after reaching a threshold it kills the app. It seems that it is suck creating websockets in a loop, creating in a few seconds more than 10000 websockets instances.

I read and implemented your best practices suggestions in order to discard that the implementation was wrong. Can you check if this is a bug on your side or is there anything we can do to mitigate this behaviour?

I'm using the latest SDK version (2.1.0) and I have some logs that I can attach if needed.

Thanks!

Memory:

Screenshot 2022-02-01 at 18 04 58

Twilio Conversations SDK websockets instances:

Screenshot 2022-02-01 at 18 05 55
Pavel-Cherentsov commented 2 years ago

Hi @rtavares89, many thanks for your investigation, looks like TCHWebsocketSessionDelegate instances leaking and overflowing..

Yes, logs would be very helpful, kindly asking to attach. Debug or trace level would be best (if possible).

rtavares89 commented 2 years ago

Hi @Pavel-Cherentsov,

Is it possible to send you the logs privately? I tried to use your support email (support@twilio.com) but I'm not able to send it due to email size. (logs just have 2.6mb)

Gray-Wind commented 2 years ago

Could you send logs with a support ticket? You can add also a link to this issue so it would be tracked easier.

rtavares89 commented 2 years ago

Hi @Gray-Wind,

Just submitted a support ticket with number # 7862815. Thanks

Gray-Wind commented 2 years ago

Sorry for the long response, we are looking into the issue. We have some understanding of what is going on, no estimates though on the release with the fix. Future communications with you regarding this issue will be held via the support ticket.

Meanwhile you can rely on reachability and not update token while the device is offline, in this case the issue won't be triggered. I will keep this ticket alive until we release the fix.

Gray-Wind commented 2 years ago

Hello, the version 2.2.1 with the fix has been just released. Please check if the issue still reproducible in your case.

Gray-Wind commented 2 years ago

I'm closing this issue, feel free to open a new issue if needed.