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

Automatic Close DB after send Message #2881

Closed Mashi-91 closed 5 months ago

Mashi-91 commented 5 months ago

[ 3][t 1][1715577124.462336063][TdDb.cpp:286][#1][!RunOnSchedulerWorker] Close all databases [ 4][t 1][1715577124.463069200][MultiPromise.cpp:15][#1][!RunOnSchedulerWorker] Add promise #1 to TdDbCloseMultiPromiseActor [ 4][t 1][1715577124.463086128][MultiPromise.cpp:30][#1][!RunOnSchedulerWorker] Get promise #1 for TdDbCloseMultiPromiseActor [ 4][t 1][1715577124.463090896][MultiPromise.cpp:30][#1][!RunOnSchedulerWorker] Get promise #2 for TdDbCloseMultiPromiseActor [ 3][t 1][1715577124.463093757][FileDb.cpp:69][#1][!FileDbActor] FileDb is closed [ 4][t 1][1715577124.463126182][MultiPromise.cpp:30][#1][!RunOnSchedulerWorker] Get promise #3 for TdDbCloseMultiPromiseActor [ 4][t 1][1715577124.463130235][MultiPromise.cpp:30][#1][!RunOnSchedulerWorker] Get promise #4 for TdDbCloseMultiPromiseActor [ 4][t 1][1715577124.463132858][MultiPromise.cpp:30][#1][!RunOnSchedulerWorker] Get promise #5 for TdDbCloseMultiPromiseActor [ 4][t 1][1715577124.463135957][MultiPromise.cpp:30][#1][!RunOnSchedulerWorker] Get promise #6 for TdDbCloseMultiPromiseActor [ 4][t 1][1715577124.463197231][MultiPromise.cpp:30][#1][!RunOnSchedulerWorker] Get promise #7 for TdDbCloseMultiPromiseActor [ 4][t 1][1715577124.463200092][Binlog.cpp:421][#1][!Binlog C:\Users\user\OneDrive\Documents\CloudInfinity\td.binlog] Flush binlog from close [ 4][t 1][1715577124.463204383][BufferedFd.h:140][#1][!Binlog C:\Users\user\OneDrive\Documents\CloudInfinity\td.binlog] Nothing to write to [fd:00000000000007A0] [ 4][t 1][1715577124.463200092][Binlog.cpp:421][#1][!Binlog C:\Users\user\OneDrive\Documents\CloudInfinity\td.binlog] Flush binlog from close [ 4][t 1][1715577124.463204383][BufferedFd.h:140][#1][!Binlog C:\Users\user\OneDrive\Documents\CloudInfinity\td.binlog] Nothing to write to [fd:00000000000007A0] [ 3][t 1][1715577124.463209867][Binlog.cpp:410][#1][!Binlog C:\Users\user\OneDrive\Documents\CloudInfinity\td.binlog] Sync binlog from close [ 3][t 1][1715577124.464155435][ConcurrentBinlog.cpp:25][#1][!Binlog C:\Users\user\OneDrive\Documents\CloudInfinity\td.binlog] Finished to close binlog [ 4][t 1][1715577124.464671611][MultiPromise.cpp:36] Receive result #1 out of 7 for TdDbCloseMultiPromiseActor [ 4][t 1][1715577124.464680910][MultiPromise.cpp:36] Receive result #2 out of 7 for TdDbCloseMultiPromiseActor [ 4][t 1][1715577124.464682579][MultiPromise.cpp:36] Receive result #3 out of 7 for TdDbCloseMultiPromiseActor [ 4][t 1][1715577124.464683771][MultiPromise.cpp:36] Receive result #4 out of 7 for TdDbCloseMultiPromiseActor [ 4][t 1][1715577124.464684963][MultiPromise.cpp:36] Receive result #5 out of 7 for TdDbCloseMultiPromiseActor [ 4][t 1][1715577124.464686155][MultiPromise.cpp:36] Receive result #6 out of 7 for TdDbCloseMultiPromiseActor [ 4][t 1][1715577124.464687108][MultiPromise.cpp:36] Receive result #7 out of 7 for TdDbCloseMultiPromiseActor [ 4][t 1][1715577124.464689254][MultiPromise.cpp:60] Set result for 1 promises in TdDbCloseMultiPromiseActor [ 3][t 1][1715577124.464905023][SqliteConnectionSafe.cpp:39] Close SQLite database [path:C:\Users\user\OneDrive\Documents\CloudInfinity\db.sqlite] [ 4][t 5][1715577124.467805862][Td.cpp:3187][#1][!Td] Decrease reference count to 0 [ 3][t 5][1715577124.467827320][Td.cpp:4034][#1][!Td][&td_requests] Sending update: updateAuthorizationState { authorization_state = authorizationStateClosed { } } [ 3][t 5][1715577124.467834711][Td.cpp:3279][#1][!Td] Stop Td [ 3][t 0][1715577124.467859983][Client.cpp:293][&td_requests] End to wait for updates, returning object 0 000001E327E61E20 [ 3][t 0][1715577124.467870235][Client.cpp:280][&td_requests] Begin to wait for updates with timeout 0.100000 [ 3][t 0][1715577124.467951774][Client.cpp:293][&td_requests] End to wait for updates, returning object 0 0000000000000000

levlam commented 5 months ago

TDLib instance can't close by itself. You call close somewhere, or exit the app completely.

Mashi-91 commented 5 months ago

h

levlam commented 5 months ago

You can find in the TDLib's log the exact close request that caused close of the TDLib instance.

Mashi-91 commented 5 months ago

I am actually sending message and its working but after send it stop

levlam commented 5 months ago

Reference to the TDLib instance is lost, which makes impossible to send further requests and hence forces the instance to close. I added more logging during instance creation and closing in the latest commit in master branch, which can help to find the cause.

Mashi-91 commented 5 months ago

bro i am actually using this package https://github.com/ivk1800/tdlib-dart cause i am in flutter. so if u tell me how i can use ur package in flutter so go ahead it would really helpful

levlam commented 5 months ago

The package uses the old TDLib JSON interface, therefore it can close TDLib instance by calling to td_json_client_destroy. The package seems to call it only if the app explicitly calls Client.destroy() and in https://github.com/ivk1800/tdlib-dart/blob/6760ab3f050f1a83e7f900de2da193f4b708f3ed/lib/src/client/platform/io/io_platform.dart#L31.

Mashi-91 commented 5 months ago

thnx brother. it would really helpfull. tell me if u need anyhelp. i am availablešŸ˜….