oxen-io / session-ios

A private messenger for iOS.
https://getsession.org
GNU General Public License v3.0
386 stars 85 forks source link

[BUG] Messages stuck on sending #975

Open shani8538 opened 1 month ago

shani8538 commented 1 month ago

Code of conduct

Self-training on how to write a bug report

Is there an existing issue for this?

Current Behavior

After using the Session IOS for a short while, if I send a message to any of my contacts it gets stuck on 'Sending'. This won't change unless I swipe off the app and clear it from my recent apps. Upon restarting the app the message will change from 'Sending' to 'Sent'. Just switching apps won't resolve the issue.

Expected Behavior

Messages should change from 'Sending' to 'Sent' instantly.

Steps To Reproduce

No response

iOS Version

17.5.1

Session Version

2.6.0

Anything else?

No response

obatard commented 1 month ago

Hello.

I have the same problem, since session 2.6.0 and iOs 17.5, especially iOS 17.5. The ios app disconnects from the nodes when the app enters in the background and doesn't automatically connects again. I have to force the app to quit and open it again to reconnect to the nodes and the message is sent. Here are some logs.

It often happens while in cellular network, no problem on wifi.

com.loki-project.loki-messenger 2024-05-21--15-07-45-785.log

royborgen commented 1 month ago

I can confirm this one. Seeing the same issue. App needs to close and then reopen. Also seen this on the Ubuntu snap desktop app

mpretty-cyro commented 1 month ago

Thanks for reporting this issue, the 2.6.0 release has actually only been rolled out to ~5% of users at the moment (lucky all of you! 😅) - we are currently working on some fixes for a few issues for the updated networking approach (see #976), there are a couple of stubborn crashes we are working on at the moment which are taking priority so I don't have a good timeline on when it might come out but any device logs you can share could help debug this issue

I have the same problem, since session 2.6.0 and iOs 17.5, especially iOS 17.5. The ios app disconnects from the nodes when the app enters in the background and doesn't automatically connects again. I have to force the app to quit and open it again to reconnect to the nodes and the message is sent. Here are some logs.

It often happens while in cellular network, no problem on wifi.

@obatard Thanks for sending through the logs and the info about the behaviour you are experiencing - this isn't actually all that obvious from the logs you have shared (there is no obvious issue in them except for a single request timeout) but luckily we've had someone internally who seems to be experiencing the same issue so we have additional logs we can compare

In this case what seems to be happening is:

Once I've sorted out these stubborn crashes this one is next on the list and is planned to be included in #976

mpretty-cyro commented 1 month ago

Tracking this on Jira as: SES-1925

mpretty-cyro commented 3 weeks ago

Version 2.6.1 has now started the phased rollout, please let me know if any of you are still experiencing this issue after updating

obatard commented 3 weeks ago

Version 2.6.1 has now started the phased rollout, please let me know if any of you are still experiencing this issue after updating

The problems are not fixed, there's no improvement, especially when we switch to the cellular network, connection to the nodes is lost and can't be established unless we kill the app and start the app again. This is an annoying bug because the messages are not sent. Here are some logs, before and after that I kill the app so the messages is sent. com.loki-project.loki-messenger 2024-06-12--17-18-34-250.log com.loki-project.loki-messenger 2024-06-12--17-18-34-250 2.log

mpretty-cyro commented 3 weeks ago

Hey @obatard, thanks for sharing these logs they were really helpful - I've opened a draft PR (#981) to track the fixes for the 2.6.1 issues

It looks like the notification extension might be suspending the network if you receive a push notification while the main app is running so I've reworked things to remove the networking logic from the notification extension (it looks like it never really ran long enough for it to be useful anyway)

If this is the cause of your issue, while it's not ideal, you might be able to get around it by disabling Fast Mode while the app is open - otherwise we'll start testing the fixes linked and can hopefully get another update out soon (I haven't seen any crashes coming through so far so this one will hopefully be faster than the last one)

obatard commented 3 weeks ago

Hey @obatard, thanks for sharing these logs they were really helpful - I've opened a draft PR (#981) to track the fixes for the 2.6.1 issues

It looks like the notification extension might be suspending the network if you receive a push notification while the main app is running so I've reworked things to remove the networking logic from the notification extension (it looks like it never really ran long enough for it to be useful anyway)

If this is the cause of your issue, while it's not ideal, you might be able to get around it by disabling Fast Mode while the app is open - otherwise we'll start testing the fixes linked and can hopefully get another update out soon (I haven't seen any crashes coming through so far so this one will hopefully be faster than the last one)

What do you mean by "Fast mode" low energy, airplane mode, notifications? It sounds like a great workaround while waiting fot the fix but I can't see how to do that in iOS 17. Anyway I'll try to disable notifications and see if that works as a workaround.

I just tried to disable all push notifications exception session app's and it worked all day, messages are sent when there's no other notifications. Sounds like it's really a notification issue.

Thank you.

mpretty-cyro commented 2 weeks ago

@obatard We've just started the rollout of 2.6.2 which aims to fix this notification-specific issue and resolves a couple of other edge-cases, if you get the chance can you please let me know how you go with that one?

There is still one other odd case that we know of which can cause issues, but it's a bit more complicated (and should be rarer) so it'll have to be in another release

What do you mean by "Fast mode" low energy, airplane mode, notifications? It sounds like a great workaround while waiting fot the fix but I can't see how to do that in iOS 17. Anyway I'll try to disable notifications and see if that works as a workaround.

In Session notifications can either be in "Fast Mode" (using push notifications) or "Slow Mode" (relying solely on Background Fetching) - you can disable Fast Mode by turning the switch off within the Session app settings at Settings -> Notifications -> Use Fast Mode

obatard commented 2 weeks ago

@obatard We've just started the rollout of 2.6.2 which aims to fix this notification-specific issue and resolves a couple of other edge-cases, if you get the chance can you please let me know how you go with that one?

There is still one other odd case that we know of which can cause issues, but it's a bit more complicated (and should be rarer) so it'll have to be in another release

It's actually worse than before the update. The messages are not sent when we switch from wifi to cellular and then randomly. Anyway it works well when we kill the app and disable all the notifications.

@obatard We've just started the rollout of 2.6.2 which aims to fix this notification-specific issue and resolves a couple of other edge-cases, if you get the chance can you please let me know how you go with that one?

There is still one other odd case that we know of which can cause issues, but it's a bit more complicated (and should be rarer) so it'll have to be in another release

What do you mean by "Fast mode" low energy, airplane mode, notifications? It sounds like a great workaround while waiting fot the fix but I can't see how to do that in iOS 17. Anyway I'll try to disable notifications and see if that works as a workaround.

In Session notifications can either be in "Fast Mode" (using push notifications) or "Slow Mode" (relying solely on Background Fetching) - you can disable Fast Mode by turning the switch off within the Session app settings at Settings -> Notifications -> Use Fast Mode

I just disabled the fast mode, I'll run some test and tell you.

obatard commented 2 weeks ago

I just disabled the fast mode, I'll run some test and tell you.

I ran some tests, no improvement whatsoever, notifications don't work and messages are not sent. I'll try to send some useful logs later. But to recap:

So, at the moment the bugs are not fixed, there are some workarounds though.

obatard commented 1 week ago

Here are some additional logs, when the bug happens without push nitification involved. com.loki-project.loki-messenger 2024-06-26--09-01-55-992.log com.loki-project.loki-messenger 2024-06-26--09-01-55-992 2.log

com.loki-project.loki-messenger 2024-06-27--11-56-44-191.log com.loki-project.loki-messenger 2024-06-27--11-56-44-191 2.log

mpretty-cyro commented 1 week ago

@obatard Thanks for the updated logs - there is nothing in particular jumping out as a root cause of the issue so I'm wondering if it's due to an optimisation we tried to add

There an annoying behaviour where iOS will kill connections in an annoying way that isn't easily detectable when going to the background so, before it can, we shut down the connections ourselves. When returning from the background we try to "recover" the previous connection (ie. establish a new connection using the same path we previously had, but don't do a reachability test) which succeeds but I'm wondering if it just thinks it has succeeded but the path isn't actually reachable.

I'll remove this "recovery" logic in 2.6.3 (#986 - will try to get a release out early next week) and instead just build new paths when returning from the background

At the very least it'll mean we can rule this behaviour out as the issue

mpretty-cyro commented 5 days ago

@obatard Sorry we've had to pull the removal of the "recovery" logic from 2.6.3 as it resulted in some other issues, there are still a couple of other fixes in there which might help but I'm less confident it'll resolve the issues you are running into

On a separate note - do you happen to use a VPN while running Session? We've found that some VPNs block QUIC connections which could result in issues (see #987)

obatard commented 4 days ago

@obatard Sorry we've had to pull the removal of the "recovery" logic from 2.6.3 as it resulted in some other issues, there are still a couple of other fixes in there which might help but I'm less confident it'll resolve the issues you are running into

Actually, it's worse. Now we can't send file and pictures. It's just stuck at sending. On Ios, MacOS and Ipad. session_debug_1720097161288.txt

On a separate note - do you happen to use a VPN while running Session? We've found that some VPNs block QUIC connections which could result in issues (see #987)

I don't use any vpn.