samp-discord-connector
samp-discord-connector copied to clipboard
Crash after calling native once Discord terminated connection
Hi! Today I investigated crash what according to the gdb backtrace was caused by throwing an exception when writing payload (the bot status) to the stream. On server I'm only updating bot activity when player disconnects and last thing what server did was calling OnPlayerDisconnect. Maybe it has to do something with connections loss?
discord-connector.log:
[10/29/19 15:04:58] [ERROR] Discord terminated websocket connection; reason: (1001)
Last message from server_log before crash occured:
[15:04:44] [part] Mikhail_Volkov has left the server (10:1)
Also crashdetect didn't respond to crash at all, nothing more in server log related to crash.
And I'll attach the backtrace. last_crash.log
Do you know what string exactly you passed to DCC_SetBotActivity
? Is this the first time that crash occurred? Can you reproduce that crash?
Yes, this is the first time I experienced this crash. It has been running for two weeks without problem. The string should be fine I use format to store player count from the variable.
hook OnPlayerDisconnect(playerid, reason)
{
g_sPlayerCount--;
UpdateDiscordClientStatus();
return Y_HOOKS_CONTINUE_RETURN_1;
}
static stock UpdateDiscordClientStatus()
{
if(!g_sPlayerCount)
{
DCC_SetBotActivity("on SFB-RP alone");
}
else if(g_sPlayerCount == 1)
{
DCC_SetBotActivity("on SFB-RP with 1 player");
}
else
{
new string[32];
format(string, sizeof(string), "SFB-RP with %i players", g_sPlayerCount);
DCC_SetBotActivity(string);
}
}
I'm not sure how could I reproduce crash, but if I could find a way to get connection terminated by discord I maybe could if that is the case.
Maybe it has to do something with connections loss?
I think yes. I also had this crash a moment ago, but on the localhost (Windows). While no connection to the internet I try to turn on local server, but the crash occur.
[13.02.2020 10:33:56] Loading plugin: discord-connector
[13.02.2020 10:34:16] >> plugin.dc-connector: timeout while initializing data.
[13.02.2020 10:34:16] plugin will proceed to retry connecting in the background.
[13.02.2020 10:34:16] Loaded.
.....
[13.02.2020 10:34:17] [debug] Server crashed while executing a_simple.amx
[13.02.2020 10:34:17] [debug] AMX backtrace:
[13.02.2020 10:34:17] [debug] #0 native DCC_SetBotActivity () in discord-connector.DLL
i had the same problem too... https://github.com/maddinat0r/samp-discord-connector/issues/96
I have the same problem, and I have some crashlogs too. Happened 2 times today in Linux. It happens randomly. I'll post the crashlogs asap
EDIT: Crashlog:
[01:04:44] [debug] Server crashed while executing gamemode.amx
[01:04:44] [debug] AMX backtrace:
[01:04:44] [debug] #0 native DCC_SetBotActivity () from discord-connector.so
[01:04:44] [debug] #1 001b8318 in UpdateBotPlayerCounter ()
[01:04:44] [debug] #2 000f3dac in public MP_OPC (playerid=4)
[01:04:44] [debug] #3 native CallLocalFunction () from samp03svr
[01:04:44] [debug] #4 0000ff84 in public IPL_OnPlayerConnect (playerid=4)
[01:04:44] [debug] #5 0000bf54 in public AB_OnPlayerConnect (playerid=4)
[01:04:44] [debug] #6 0000918c in public SSCANF_OnPlayerConnect (playerid=4)
[01:04:44] [debug] #7 00002234 in public Iter_OnPlayerConnect (playerid=4)
[01:04:44] [debug] #8 native CallLocalFunction () from samp03svr
[01:04:44] [debug] #9 00000718 in public OnPlayerConnect (playerid=4)
[01:04:44] [debug] Native backtrace:
[01:04:44] [debug] #0 f7307180 in _Z13GetStackTraceRSt6vectorI10StackFrameSaIS0_EEPv () from plugins/crashdetect.so
[01:04:44] [debug] #1 f72ff064 in _ZN11CrashDetect20PrintNativeBacktraceERSoRKN2os7ContextE () from plugins/crashdetect.so
[01:04:44] [debug] #2 f72ffd64 in _ZN11CrashDetect20PrintNativeBacktraceERKN2os7ContextE () from plugins/crashdetect.so
[01:04:44] [debug] #3 f7301cdb in _ZN11CrashDetect7OnCrashERKN2os7ContextE () from plugins/crashdetect.so
[01:04:44] [debug] #4 f73064d5 in ?? () from plugins/crashdetect.so
[01:04:44] [debug] #5 f76feb90 in ?? ()
[01:04:44] [debug] #6 f76feba9 in ?? ()
[01:04:44] [debug] #7 f735aea9 in gsignal () from /lib/i386-linux-gnu/libc.so.6
[01:04:44] [debug] #8 f735c407 in abort () from /lib/i386-linux-gnu/libc.so.6
[01:04:44] [debug] #9 f75cad35 in _ZN9__gnu_cxx27__verbose_terminate_handlerEv () from /usr/lib/i386-linux-gnu/libstdc++.so.6
[01:04:44] [debug] #10 f75c8833 in ?? () from /usr/lib/i386-linux-gnu/libstdc++.so.6
[01:04:44] [debug] #11 f75c88ad in ?? () from /usr/lib/i386-linux-gnu/libstdc++.so.6
[01:04:44] [debug] #12 f75c8b70 in __cxa_rethrow () from /usr/lib/i386-linux-gnu/libstdc++.so.6
[01:04:44] [debug] #13 f47c2e1f in ?? () from plugins/discord-connector.so
[01:04:44] [debug] #14 f47eb87b in ?? () from plugins/discord-connector.so
[01:04:44] [debug] #15 f47b8346 in ?? () from plugins/discord-connector.so
[01:04:44] [debug] #16 f4734a3a in ?? () from plugins/discord-connector.so
[01:04:44] [debug] #17 f47f0071 in ?? () from plugins/discord-connector.so
[01:04:44] [debug] #18 0809d844 in ?? () from ./samp03svr
[01:04:44] [debug] #19 f7300ad3 in _ZN11CrashDetect17HandleAMXCallbackEiPiS0_ () from plugins/crashdetect.so
[01:04:44] [debug] #20 f739a117 in _IO_setb () from /lib/i386-linux-gnu/libc.so.6
[01:04:44] [debug] Registers:
[01:04:44] [debug] EAX: 00000000 EBX: 0000086c ECX: 0000086c EDX: 00000006
[01:04:44] [debug] ESI: 081aed6c EDI: ff960a44 EBP: ff960b18 ESP: ff960988
[01:04:44] [debug] EIP: f76feba9 EFLAGS: 00200206
[01:04:44] [debug] Stack:
[01:04:44] [debug] ESP+00000000: ff960b18 00000006 0000086c f735aea9
[01:04:44] [debug] ESP+00000020: 00000000 ff960a18 f7723a74 00000006
[01:04:44] [debug] ESP+00000040: 00000000 00000000 00000000 00000000
[01:04:44] [debug] ESP+00000060: 00000000 00000000 00000000 00000000
[01:04:44] [debug] ESP+00000080: 00000000 00000000 00000000 00000000
[01:04:44] [debug] ESP+000000a0: 00000000 00000000 00000000 00000000
[01:04:44] [debug] ESP+000000c0: 00000005 f76fb740 f7708a70 f756032c
[01:04:44] [debug] ESP+000000e0: f76fb8f8 f74e59a0 00000001 00000005
[01:04:44] [debug] ESP+00000100: f74e1cc0 f739461d f7723000 f757532c
[01:04:44] [debug] ESP+00000120: 081aed6c 09b9b048 f770d7eb f76cb000
[01:04:44] [debug] ESP+00000140: 097149f0 f735c2b0 f735c2b7 f76cb000
[01:04:44] [debug] ESP+00000160: 00000000 f49215e0 00000000 00000000
[01:04:44] [debug] ESP+00000180: f75cabeb f76cb000 09714a20 f4a1a148
[01:04:44] [debug] ESP+000001a0: f76cb000 f75c88ad f75cabe0 f7714010
[01:04:44] [debug] ESP+000001c0: f76cb000 f75c8b70 09714a20 f76fb740
[01:04:44] [debug] ESP+000001e0: f4a21000 f47c2e1f 09714a40 f4a1a148
[01:04:44] [debug] ESP+00000200: ff960b9c ff960c5c f7723000 f757532c
[01:04:44] [debug] ESP+00000220: 00000001 f4a2c1e8 ff960bb8 00000000
[01:04:44] [debug] ESP+00000240: f4a1a248 00000000 f492f120 f492e1c4
[01:04:44] [debug] ESP+00000260: f47c2c7b f4a21000 ff960c44 ff960c70
[01:04:44] [debug] ESP+00000280: ff960c70 f47eb835 0000007d ff960c5c
[01:04:44] [debug] ESP+000002a0: 00000001 f4a2c1e8 f4a1a270 081aee1c
[01:04:44] [debug] ESP+000002c0: 00000000 00000000 00000000 00000000
[01:04:44] [debug] ESP+000002e0: 00000001 f4a2c1e8 ff960c78 00000000
[01:04:44] [debug] ESP+00000300: f4a1a384 00000000 f492f120 f492e1c4
[01:04:44] [debug] ESP+00000320: 00000000 f3321450 f4a21000 ff960de4
[01:04:44] [debug] ESP+00000340: ff960ec8 f47b8324 00000000 00000000
[01:04:44] [debug] ESP+00000360: ff960e4c ff960e38 ff960e24 ff960e10
[01:04:44] [debug] ESP+00000380: ff960e0c 09bd41f8 00000000 09a0453c
[01:04:44] [debug] ESP+000003a0: 00000000 00000001 09cc4498 ff960ec8
[01:04:44] [debug] ESP+000003c0: 00000000 00000000 ff960d44 00000001
[01:04:44] [debug] ESP+000003e0: 00000001 00000000 00000000 00000000
[01:04:44] [debug] Loaded modules:
[01:04:44] [debug] 00000000 - 00194f0b samp03svr
[01:04:44] [debug] f76fe000 - f76fecfb
[01:04:44] [debug] f76ec000 - f76eea04 /lib/i386-linux-gnu/libdl.so.2
[01:04:44] [debug] f76cf000 - f76ea6ef /lib/i386-linux-gnu/libpthread.so.0
[01:04:44] [debug] f7558000 - f76d8b4b /usr/lib/i386-linux-gnu/libstdc++.so.6
[01:04:44] [debug] f7503000 - f7557010 /lib/i386-linux-gnu/libm.so.6
[01:04:44] [debug] f74e6000 - f75021e4 /lib/i386-linux-gnu/libgcc_s.so.1
[01:04:44] [debug] f732f000 - f74ebb6b /lib/i386-linux-gnu/libc.so.6
[01:04:44] [debug] f76ff000 - f77229c4 /lib/ld-linux.so.2
[01:04:44] [debug] f72e9000 - f732bac4 plugins/crashdetect.so
[01:04:44] [debug] f72d9000 - f72e81d4 plugins/sscanf.so
[01:04:44] [debug] f7213000 - f72d8740 plugins/streamer.so
[01:04:44] [debug] f720a000 - f7211714 /lib/i386-linux-gnu/librt.so.1
[01:04:44] [debug] f71a9000 - f720994a plugins/mysql.so
[01:04:44] [debug] f7185000 - f71a8d32 /home/samp/server/samp03/plugins/../log-core.so
[01:04:44] [debug] f6d73000 - f7186e9f /home/samp/server/samp03/plugins/../libmysqlclient.so.18
[01:04:44] [debug] f655f000 - f65702ec /lib/i386-linux-gnu/libnss_files.so.2
[01:04:44] [debug] f647a000 - f65623e9 plugins/pawncmd.so
[01:04:44] [debug] f644a000 - f64784e3 plugins/log-plugin.so
[01:04:44] [debug] f6235000 - f6455348 /home/samp/server/samp03/plugins/../log-core2.so
[01:04:44] [debug] f46bd000 - f4a4f67e plugins/discord-connector.so
[01:04:44] [debug] f3e34000 - f3e38a38 /lib/i386-linux-gnu/libnss_dns.so.2
[01:04:44] [debug] f3e1b000 - f3e32494 /lib/i386-linux-gnu/libresolv.so.2
I update the bot activity on player connect and disconnect, using the same method as kubkodev looks like it crashed while updating it when a player connected. The log shows 2 players connecting at the same second.