NetStats_MessagesReceived - crash server
#1

Good day!

Function in a one-second timer NetStats_MessagesReceived would crash the server.

p.s. Crash occurred in the past ( in 0.3x), when I had to parse the data GetPlayerNetworkStats

Why is this happening?

Code:
pawn Код:
for(new i, m = GetMaxPlayers(); i < m; i ++) {
        if(!IsPlayerConnected(i)) continue;

        var = NetStats_MessagesReceived(i);
        if(var - MessagesCount[i] > 1000) {
            printf("playerid: %i, messagesReceived: %i messagesCount %i", i, var, MessagesCount[i]);
            Ban(i);
            continue;
        }
        else MessagesCount[i] = var;
        ...
    }

[15/02/14 16:23:52] [debug] Server crashed while executing GameMode.amx
[15/02/14 16:23:52] [debug] AMX backtrace:
[15/02/14 16:23:52] [debug] #0 native NetStats_MessagesReceived () [080d9ec0] from samp03svr
[15/02/14 16:23:52] [debug] #1 000ebe50 in public TimerOneSecond () from GameMode.amx
[15/02/14 16:23:52] [debug] Native backtrace:
[15/02/14 16:23:52] [debug] #0 006d360b in _ZN10StackTraceC1EPv () from plugins/crashdetect.so
[15/02/14 16:23:52] [debug] #1 006cae92 in _ZN11CrashDetect20PrintNativeBacktraceEPv () from plugins/crashdetect.so
[15/02/14 16:23:52] [debug] #2 006cc8d9 in _ZN11CrashDetect11OnExceptionEPv () from plugins/crashdetect.so
[15/02/14 16:23:52] [debug] #3 006d32a0 in ?? () from plugins/crashdetect.so
[15/02/14 16:23:52] [debug] #4 00d8c410 in ?? ()
[15/02/14 16:23:52] [debug] #5 08082a46 in ?? () from ./samp03svr
[15/02/14 16:23:52] [debug] #6 0807e43c in ?? () from ./samp03svr
[15/02/14 16:23:52] [debug] #7 0806fd49 in ?? () from ./samp03svr
[15/02/14 16:23:52] [debug] #8 080d9f08 in ?? () from ./samp03svr
[15/02/14 16:23:52] [debug] #9 08093d84 in ?? () from ./samp03svr
[15/02/14 16:23:52] [debug] #10 006ca5fc in _ZN11CrashDetect13DoAmxCallbackEiPiS0_ () from plugins/crashdetect.so
[15/02/14 16:23:52] [debug] #11 006cf15c in ?? () from plugins/crashdetect.so
[15/02/14 16:23:52] [debug] #12 006d764d in amx_Exec () from plugins/crashdetect.so
[15/02/14 16:23:52] [debug] #13 006ccabb in _ZN11CrashDetect9DoAmxExecEPii () from plugins/crashdetect.so
[15/02/14 16:23:52] [debug] #14 006cf100 in ?? () from plugins/crashdetect.so
[15/02/14 16:23:52] [debug] #15 080e57a5 in ?? () from ./samp03svr
[15/02/14 16:23:52] [debug] #16 080acedb in ?? () from ./samp03svr
[15/02/14 16:23:52] [debug] #17 080a81ae in ?? () from ./samp03svr
[15/02/14 16:23:52] [debug] #18 001cece6 in __libc_start_main () from /lib/libc.so.6
[15/02/14 16:23:52] [debug] #19 0804b4a1 in ?? () from ./samp03svr
Reply
#2

Please try running server with gdb like this and get a more useful crash report:

https://sampforum.blast.hk/showthread.php?tid=495402
Reply
#3

I deleted function NetStats_MessagesReceived.

NetStats_BytesReceived function causes the same problem


pawn Код:
for(new i, m = GetMaxPlayers(); i < m; i ++) {
        if(!IsPlayerConnected(i)) continue;

        f_var[1] = NetStats_BytesReceived(i);
        if(f_var[1] - BytesCount[i] > 7500) {
            Ban(i);
            continue;
        }
        else BytesCount[i] = f_var[1];
        ...
    }

[debug] Server crashed while executing GameMode.amx
[debug] AMX backtrace:
[debug] #0 native NetStats_BytesReceived () [080d9f60] from samp03svr
[debug] #1 000f0008 in public TimerOneSecond () from GameMode.amx
...




p.s. I would not use these features, but how to defend against dos attacks?
Reply
#4

Confirmed
Reply
#5

bump
Reply
#6

--->
Quote:
Originally Posted by JernejL
Посмотреть сообщение
Please try running server with gdb like this and get a more useful crash report:

https://sampforum.blast.hk/showthread.php?tid=495402
Reply
#7

what if its windows
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)