tdlib / td

Cross-platform library for building Telegram clients
https://core.telegram.org/tdlib
Boost Software License 1.0
7.11k stars 1.44k forks source link

Is it TDLib being stuck? #2720

Closed eztm closed 10 months ago

eztm commented 10 months ago

Hey! Appreciate some help as couple days ago we started to experience freezes in some accounts.

The flow is: 1) TDLib client is initiated 2) Starting to loadChats, sending and receiving messages 3) In couple minutes while there are still some movements happening in TDLib logs we dont get any new chats or messages. 4) Waiting any time for up to several hours 5) Trying to close client and not getting authorizationStateClosing and authorizationStateClosed updates 6) Trying to initiate client again and nothing happens

For now it is happening with some particular clients while others have no issues. We did capture this behaviour with just one client and verbosity level 4 but not sure what exactly to look for.

levlam commented 10 months ago

This means that your app stopped to call receive to get updates and request responses from TDLib. Usually, this happens because the dedicated thread that calls receive is blocked and waits for something synchronously, or was terminated because of an unhandled exception.

In the TDLib log you can look for lines with "[&td_requests]". If you see "Sending update: " lines, then TDLib works and sends all data. If you also see "Begin to wait for updates with timeout" lines, then everything works and receive is called to get new updates. If there are no such lines, then you can find approximate issue time locating the last line "End to wait for updates".

eztm commented 10 months ago

From the logs it seems that TDLib keep sending updates but at some point "Begin to wait for updates with timeout" disappear. This means it can be only external issue in our code or TDLib wrapper, something around calling receive right?

levlam commented 10 months ago

Yes, the cause of the issue isn't related to TDLib. I mentioned the most common reasons in the previous message.