vysheng / tg

telegram-cli
GNU General Public License v2.0
6.49k stars 1.54k forks source link

telegram-cli crashes on unknown fwd_id #1009

Open che-shr-cat opened 8 years ago

che-shr-cat commented 8 years ago

Hello,

I'm using the test branch and when trying to fetch channel history sometimes get crash and the following error log:

1455635545.467651 unknown fwd_id 
1455635545.467654 unknown fwd_id
SIGNAL received
^@h/usr/share/telegram-daemon/bin/telegram-cli(print_backtrace+0x20)[0x46ed80]
/usr/share/telegram-daemon/bin/telegram-cli(termination_signal_handler+0x64)[0x46ee04]
/lib/x86_64-linux-gnu/libc.so.6(+0x36d40)[0x7f578b435d40]
/usr/share/telegram-daemon/bin/telegram-cli(json_pack_message+0x53)[0x48aa53]
/usr/share/telegram-daemon/bin/telegram-cli(print_msg_list_gw+0xea)[0x481aea]
/usr/share/telegram-daemon/bin/telegram-cli(print_msg_list_history_gw+0x17)[0x481c27]
/usr/share/telegram-daemon/bin/telegram-cli[0x4955d6]
/usr/share/telegram-daemon/bin/telegram-cli(tglq_query_result+0x10f)[0x49844f]
/usr/share/telegram-daemon/bin/telegram-cli[0x490d3a]
/usr/share/telegram-daemon/bin/telegram-cli[0x4b625b]
/usr/lib/x86_64-linux-gnu/libevent-2.0.so.5(event_base_loop+0x754)[0x7f578c872f24]
/usr/share/telegram-daemon/bin/telegram-cli(net_loop+0xa6)[0x470306]
/usr/share/telegram-daemon/bin/telegram-cli(loop+0x187)[0x471607]
/usr/share/telegram-daemon/bin/telegram-cli(main+0x2e5)[0x46d5e5]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5)[0x7f578b420ec5]
/usr/share/telegram-daemon/bin/telegram-cli[0x46d6f5]

Does anyone have the same problem?

pishgaman-org commented 8 years ago

I had same problem and solved it myself. because it seems this project hasn't good support team.

open structures.c file located in tgl directory. find these lines at about 1550 and 1595:

  if (DS_M->fwd_from_id) {
    FF = tgl_peer_get (TLS, tglf_fetch_peer_id (TLS, DS_M->fwd_from_id));
    if (!FF) {
      tgl_do_get_difference (TLS, 0, 0, 0);
      vlogprintf (E_NOTICE, "unknown fwd_id\n");
      return NULL;
    }
  }
    tgl_peer_id_t fwd_from_id;
    if (DS_M->fwd_from_id) {
      fwd_from_id = FF->id;
    } else {
      fwd_from_id = TGL_MK_USER (0);
    }

and modify them as follows :

  if (DS_M->fwd_from_id) {
    FF = tgl_peer_get (TLS, tglf_fetch_peer_id (TLS, DS_M->fwd_from_id));
    if (!FF) {
      tgl_do_get_difference (TLS, 0, 0, 0);
      vlogprintf (E_NOTICE, "unknown fwd_id\n");
      //return NULL;
    }
  }
    tgl_peer_id_t fwd_from_id;
    if (DS_M->fwd_from_id && FF) {
      fwd_from_id = FF->id;
    } else {
      fwd_from_id = TGL_MK_USER (0);
    }

recompile and enjoy!

che-shr-cat commented 8 years ago

Thanks a lot!

ufuran commented 8 years ago

How to recompile?