TelegramMessenger / MTProxy

4.97k stars 822 forks source link

net/net-msg.c:1303: rwm_process_encrypt_decrypt: Assertion `X' failed #417

Open DevPGSV opened 4 years ago

DevPGSV commented 4 years ago

Some users pointed out they where having problems with the proxy as soon as I upgraded it. I was running a very old version (no idea which version, but it was from at least 2 years ago). After upgrading, now I am running: mtproxy-0.01 compiled at Sep 8 2020 08:41:59 by gcc 9.3.0 64-bit after commit dc0c7f3de40530053189c572936ae4fd1567269b

I am running the proxy with a systemd service, so I didn't notice at first it was crashing, because it was started again as soon as it crashed. I decided to run it in a tmux session to check what happened, and about 40 minutes later I found this:

./mtproto-proxy -u nobody -p 8085 -H 2233 -P ... -S ... --aes-pwd proxy-secret proxy-multi.conf -M 1 --http-stats

[24176][2020-09-09 20:31:38.445265 local] Invoking engine mtproxy-0.01 compiled at Sep  8 2020 08:41:59 by gcc 9.3.0 64-bit after commit dc0c7f3de40530053189c572936ae4fd1567269b
[24176][2020-09-09 20:31:38.445380 local] config_filename = 'proxy-multi.conf'
[24176][2020-09-09 20:31:38.447722 local] creating 1 workers
[24176][2020-09-09 20:31:38.450026 local] Started as [147.96.25.75:8085:24176:1599676298]
[24177][2020-09-09 20:31:38.450311 local] Started as [147.96.25.75:8085:24177:1599676298]
[24176][2020-09-09 20:31:38.450585 local] configuration file proxy-multi.conf re-read successfully (752 bytes parsed), new configuration active
[24176][2020-09-09 20:31:38.450633 local] main loop
[24177][2020-09-09 20:31:38.450647 local] configuration file proxy-multi.conf re-read successfully (752 bytes parsed), new configuration active
[24177][2020-09-09 20:31:38.450731 local] main loop
mtproto-proxy: net/net-msg.c:1303: rwm_process_encrypt_decrypt: Assertion `X' failed.
[pid 24177] [time 1599679116]
------- Stack Backtrace -------
./mtproto-proxy(print_backtrace+0x1a)[0x563588368e9a]
./mtproto-proxy(extended_debug_handler+0x10)[0x563588368fe0]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x14140)[0x7f886ae2d140]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x141)[0x7f886ac8fcb1]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x123)[0x7f886ac79537]
/lib/x86_64-linux-gnu/libc.so.6(+0x2540f)[0x7f886ac7940f]
/lib/x86_64-linux-gnu/libc.so.6(+0x344d2)[0x7f886ac884d2]
./mtproto-proxy(rwm_process_encrypt_decrypt+0x462)[0x5635883483d2]
./mtproto-proxy(rwm_process_ex+0x1dc)[0x56358834a43c]
./mtproto-proxy(rwm_encrypt_decrypt_to+0x117)[0x56358834b0a7]
./mtproto-proxy(cpu_tcp_aes_crypto_encrypt_output+0x57)[0x563588359657]
./mtproto-proxy(cpu_tcp_server_writer+0x80)[0x563588359290]
./mtproto-proxy(cpu_server_read_write+0x15)[0x56358834ec35]
./mtproto-proxy(do_connection_job+0xd1)[0x563588351121]
./mtproto-proxy(unlock_job+0x413)[0x563588341383]
./mtproto-proxy(run_pending_main_jobs+0x62)[0x563588341f72]
./mtproto-proxy(default_engine_server_start+0x167)[0x563588363d07]
./mtproto-proxy(default_main+0x1b3)[0x5635883643c3]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xea)[0x7f886ac7acca]
./mtproto-proxy(_start+0x2a)[0x563588330d1a]
[pid 24177] [time 1599679116] -------------------------------
[pid 24177] [time 1599679116] mtproxy-0.01 compiled at Sep  8 2020 08:41:59 by gcc 9.3.0 64-bit after commit dc0c7f3de40530053189c572936ae4fd1567269b[pid 24177] [time 1599679116]
[24176][2020-09-09 21:18:37.005658 local] Child 24177 terminated, aborting

It references https://github.com/TelegramMessenger/MTProxy/blob/ce9933813dd1473e8158b45abf38fa45cbd3b84c/net/net-msg.c#L1303 , but I have no idea how to solve this.

Some (perhaps) usefull information:

# uname -a
Linux timbernerslee.s.librelabucm.org 4.9.0-13-amd64 #1 SMP Debian 4.9.228-1 (2020-07-05) x86_64 GNU/Linux
# nproc
8
# free -h
              total        used        free      shared  buff/cache   available
Mem:            15G        5,7G        815M        734M        9,0G        8,8G
Swap:          3,9G        1,2G        2,6G

Usage statistics (@MTProxybot):

Daily stats:
2020-09-09        9 769
2020-09-08           94
2020-09-07           77
2020-09-06           78

Hourly stats:
19:00-19:59          884
18:00-18:59        1 896
17:00-17:59        1 893
16:00-16:59        1 835