Connecting to Chatmail takes a long time

Hello :wave:,
connecting to a Chatmail account in DC-iOS sometimes takes a long time.
It can last up to 40 seconds and seems to occur more frequently.
I’m not sure if it’s a bug or if it’s due to maintenance work on the chat server.
However, the problem has so far only occurred in DC-iOS.
Does anyone know more about it?

Indeed, it’s slow. This is with a quite fast connection:

pytest --durations=8 cmdeploy/src/cmdeploy/tests/online/ 
============================================================================================================ test session starts ============================================================================================================
platform linux -- Python 3.10.12, pytest-7.4.3, pluggy-1.3.0 -- /home/user/code/chatmail/venv/bin/python3
cachedir: .pytest_cache
Deltachat core=v1.132.0 sqlite=3.39.4 journal_mode=wal
rootdir: /home/user/code/chatmail/cmdeploy/src/cmdeploy/tests
configfile: pytest.ini
plugins: deltachat-1.132.0, cmdeploy-0.2, deltachat-rpc-client-1.127.0, xdist-3.5.0
collected 2 items                                                                                                                                                                                                                           

cmdeploy/src/cmdeploy/tests/online/[imap] PASSED                                                                                                                                         [ 50%]
cmdeploy/src/cmdeploy/tests/online/[smtp] PASSED                                                                                                                                         [100%]

============================================================================================================ slowest 8 durations ============================================================================================================
17.08s call     online/[smtp]
8.82s call     online/[imap]

(4 durations < 0.005s hidden.  Use -vv to show these durations.)
============================================================================================================ 2 passed in 25.99s =============================================================================================================

CPU & RAM seem normal.

Then again, cmdeploy bench is working well:

[$ pytest --pyargs -vrx]
============================================================================================================ test session starts ============================================================================================================
platform linux -- Python 3.10.12, pytest-7.4.3, pluggy-1.3.0 -- /home/user/code/chatmail/venv/bin/python3
cachedir: .pytest_cache
Deltachat core=v1.132.0 sqlite=3.39.4 journal_mode=wal
rootdir: /home/user/code/chatmail
plugins: deltachat-1.132.0, cmdeploy-0.2, deltachat-rpc-client-1.127.0, xdist-3.5.0
collected 7 items                                                                                                                                                                                                                           

cmdeploy/src/cmdeploy/tests/online/ PASSED                                                                                                                                                                 [ 14%]
cmdeploy/src/cmdeploy/tests/online/ PASSED                                                                                                                                                               [ 28%]
cmdeploy/src/cmdeploy/tests/online/ PASSED                                                                                                                                                                 [ 42%]
cmdeploy/src/cmdeploy/tests/online/ PASSED                                                                                                                                                               [ 57%]
cmdeploy/src/cmdeploy/tests/online/ PASSED                                                                                                                                                    [ 71%]
cmdeploy/src/cmdeploy/tests/online/ PASSED                                                                                                                                                        [ 85%]
cmdeploy/src/cmdeploy/tests/online/ PASSED                                                                                                                                               [100%]
============================================================================================================= benchmark results =============================================================================================================

benchmark name                 median    min    max
imap_connect                     0.14   0.13   0.14
imap_connect_and_login           0.23   0.21   0.25
smtp_connect                     0.20   0.19   0.37
smtp_connect_and_login           0.29   0.28   0.30
dc_autoconfig_and_idle_ready     1.34   1.32   1.38
dc_ping_pong                     0.59   0.56   1.30
dc_send_10_receive_10            2.65   2.35   2.67
============================================================================================================ 7 passed in 36.91s =============================================================================================================

There might be some bug where failed connection attempts (of being offline) stack up and trigger a timeout when it connects again. Have you played with stuff like flight mode?

No I haven’t. But I quit apps sometimes. I did it earlier because I thought it would save energy. Still trying to break the habit.

They are frozen on iOS, so not really save energy :wink:

Anyways let’s check if it is faster again when the next version releases in ~1,5 months (according to our internal “roadmap”)

I know, but occasionally I slip back into old habits. :grin:

Unfortunately, this issue still exists in DC-iOS 1.44. It can take up to a minute for a connection to be established. In DC-Desktop 1.44 and DC-Android 1.44, there can sometimes be problems connecting, but this is very rare.
During testing, I noticed that this problem only occurs with DC-iOS when I am connected to the Internet via WLAN and mobile data is deactivated. I don’t think the WLAN is the cause since the normal email accounts work with DC. In addition, the problem only occurs very rarely with DC-Desktop and DC-Android on the same WLAN.
Does anybody have the same Problem?
I have the impression that the situation improved over the weekend.
Maybe the server has been updated?

A log collected when connection takes long time would be helpful. There have been some improvements wrt. IMAP connection in 1.44, e.g. this: fix(imap): allow maybe_network to interrupt connection ratelimit by link2xt · Pull Request #5297 · deltachat/deltachat-core-rust · GitHub

The problem seems to weaken from time to time and then increase again.
Today, an error message was displayed for the first time:

Recently, DC-iOS sometimes crashes at startup.
As far as I can remember, this happened first in version 1.44.1.
Either the Delta Chat logo is displayed at startup and the app freezes or when trying to connect to Chatmail, it is closed. I can’t find anything in the log.
Therefore, I originally wanted to wait until the new log is implemented before reporting the problem. But now I think that the crashes and the connection problem are probably related somehow.

1 Like

that can mean that the background fetch function (background notification code) is currently running. or could also mean that sth went wrong somewhere else and stopped the account.
maybe it would make sense to show “account paused” there in the cases the background fetch locks the account?
maybe the new log can give you more info of what is happening, this screen should never appear to users