Skip to content
This repository has been archived by the owner on Jan 27, 2024. It is now read-only.

Assertion failed queries.c:1598 #276

Open
EionRobb opened this issue May 15, 2016 · 2 comments
Open

Assertion failed queries.c:1598 #276

EionRobb opened this issue May 15, 2016 · 2 comments
Labels

Comments

@EionRobb
Copy link
Contributor

When connecting to my telegram account, I'm getting an assert() quit;

--debug log

[New Thread 8864.0x2114]
(20:21:50) prpl-telegram: update_user_handler() flags: CREATED PHONE PHOTO NAME FLAGS ACCESS_HASH
(20:21:50) prpl-telegram: 333000: when=0
(20:21:50) prpl-telegram: mobile
(20:21:50) blist: Updating buddy status for Telegram (Telegram)
[Thread 8864.0x2114 exited with code 0]
[New Thread 8864.0xf30]
[New Thread 8864.0x1834]
(20:21:50) proxy: Connecting to login.skype.com:443.
(20:21:50) proxy: Connected to login.skype.com:443.
[New Thread 8864.0x1484]
[Thread 8864.0x1834 exited with code 0]
(20:21:50) dnsquery: IP resolved for api.steampowered.com
(20:21:50) proxy: Attempting connection to 104.84.76.144
[Thread 8864.0xf30 exited with code 0]
(20:21:50) proxy: Connecting to api.steampowered.com:443 with no proxy
[Thread 8864.0x21d8 exited with code 0]
(20:21:50) proxy: Connection in progress
[New Thread 8864.0xc30]
(20:21:50) prpl-telegram: update_chat_handler() flags: CREATED PHOTO TITLE
(20:21:50) prpl-telegram: update_user_handler() flags: CREATED PHOTO NAME ACCESS_HASH USERNAME
(20:21:50) prpl-telegram: update_user_handler() flags: CREATED PHOTO NAME ACCESS_HASH USERNAME
(20:21:50) prpl-telegram: 75644881: when=0
(20:21:50) prpl-telegram: mobile
(20:21:50) blist: Updating buddy status for Jo (Telegram)
(20:21:50) prpl-telegram: update_user_handler() flags: CREATED PHONE PHOTO NAME FLAGS ACCESS_HASH USERNAME
(20:21:50) prpl-telegram: update_user_handler() flags: CREATED PHOTO NAME ACCESS_HASH
(20:21:50) prpl-telegram: 67305174: when=0
(20:21:50) prpl-telegram: mobile
(20:21:50) blist: Updating buddy status for dx (Telegram)
(20:21:50) prpl-telegram: update_user_handler() flags: CREATED PHOTO NAME ACCESS_HASH USERNAME
(20:21:50) prpl-telegram: 115630664: when=0
(20:21:50) prpl-telegram: mobile
(20:21:50) blist: Updating buddy status for Mike Gebirge (Telegram)
(20:21:50) prpl-telegram: update_user_handler() flags: CREATED PHONE PHOTO NAME ACCESS_HASH USERNAME
(20:21:50) prpl-telegram: 167168959: when=0
(20:21:50) prpl-telegram: mobile
(20:21:50) blist: Updating buddy status for Vagner Dantas (Telegram)
(20:21:50) prpl-telegram: update_user_handler() flags: CREATED PHOTO NAME ACCESS_HASH USERNAME
(20:21:50) prpl-telegram: 4819078: when=0
(20:21:50) prpl-telegram: mobile
(20:21:50) blist: Updating buddy status for Alexander J. Salas B. (Telegram)
(20:21:50) prpl-telegram: update_user_handler() flags: CREATED PHOTO NAME ACCESS_HASH USERNAME
(20:21:51) prpl-telegram: 50101506: when=0
(20:21:51) prpl-telegram: mobile
(20:21:51) blist: Updating buddy status for Tom ??? (Telegram)
(20:21:51) prpl-telegram: update_user_handler() flags: CREATED PHOTO NAME ACCESS_HASH USERNAME
(20:21:51) prpl-telegram: 6603391: when=0
(20:21:51) prpl-telegram: mobile
(20:21:51) blist: Updating buddy status for David GF (Telegram)
(20:21:51) prpl-telegram: resolving duplicate for Telegram, assigning: Telegram #1
(20:21:51) prpl-telegram: update_user_handler() flags: CREATED PHONE PHOTO NAME ACCESS_HASH
(20:21:51) prpl-telegram: 777000: when=0
(20:21:51) prpl-telegram: mobile
(20:21:51) blist: Updating buddy status for Telegram #1 (Telegram)
Assertion failed!

Program: C:\Program Files (x86)\Pidgin\pidgin.exe
File: queries.c, Line 1598

Expression: P

some info from GDB:

(gdb) print *DS_D
$4 = {magic = 3252518986, peer = 0x10e0d5d0, top_message = 0x10f10a20, read_inbox_max_id = 0x10f109b0, unread_count = 0x10f10af0,
  notify_settings = 0x10e8ad50, top_important_message = 0x0, unread_important_count = 0x0, pts = 0x0}
(gdb) print *DS_D->peer
$5 = {magic = 2645671021, user_id = 0x10f10990, chat_id = 0x0, channel_id = 0x0}
(gdb) print tglf_fetch_peer_id (TLS, DS_D->peer)
$6 = {peer_type = 1, peer_id = 33248243, access_hash = 0}
(gdb) print tgl_peer_get(TLS, tglf_fetch_peer_id (TLS, DS_D->peer))
$7 = (tgl_peer_t *) 0x0

Not quite sure what all the single-letter variables mean, but should it just be continueing if P == NULL ?

@rdvl97
Copy link

rdvl97 commented Jun 4, 2016

Getting the same issue here on windows 7.
Happens on startup when loading up unread messages.
Should I upload my STDOUT log here?
(I ask because it looks like it contains some account info)

@majn majn added the bug label Jul 29, 2016
@BenWiederhake
Copy link
Collaborator

What do you think could be happening here? It seems like Telegram is sending a dialog list containing a dialog with a "peer" (which includes groups and channels) that isn't known to tgl (tree_lookup_peer within tgl_peer_get doesn't find anything). My first guess is that this can only happen if a dialog is added between the time we get the peer list and the dialog list (I don't understand the different between these concepts). My second guess would be a missing access_hash.

Here's a patch that should work around the issue like you suggested, complains when it happens, and allows a human to postmortemly determine what the difference seems to be. Note that access_hash is censored already.

diff --git a/queries.c b/queries.c
index 4e8eb5a..c989127 100644
--- a/queries.c
+++ b/queries.c
@@ -1714,7 +1714,16 @@ static int get_dialogs_on_answer (struct tgl_state *TLS, struct query *q, void *
 
   for (i = 0; i < dl_size; i++) {
     struct tl_ds_dialog *DS_D = DS_MD->dialogs->data[i];
-    tgl_peer_t *P = tgl_peer_get (TLS, tglf_fetch_peer_id (TLS, DS_D->peer));
+    tgl_peer_id_t P_id = tglf_fetch_peer_id (TLS, DS_D->peer);
+    tgl_peer_t *P = tgl_peer_get (TLS, P_id);
+    if (!P) {
+      vlogprintf (E_ERROR, "No peer found for peer id: type=%d, id=%d, access=%s, raw_id=%d\n",
+                  P_id.peer_type, P_id.peer_id, P_id.access_hash > 0 ? "y" : "n", *DS_D->peer->user_id);
+      continue;
+    } else {
+      vlogprintf (E_DEBUG, "Peer found for peer id: type=%d, id=%d, access=%s, raw_id=%d\n",
+                  P_id.peer_type, P_id.peer_id, P_id.access_hash > 0 ? "y" : "n", *DS_D->peer->user_id);
+       }
     assert (P);
     E->PL[E->list_offset + i] = P->id;
     E->LMD[E->list_offset + i] = tgl_peer_id_to_msg_id (E->PL[E->list_offset + i], DS_LVAL (DS_D->top_message));

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants