crashdetect - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: crashdetect (
/showthread.php?tid=571924)
crashdetect -
FinStar - 23.04.2015
pawn Код:
[OnGameModeExit] Shutting down...
[19:18:22] [debug] Server crashed while executing ScavengeSurvive.amx
[19:18:22] [debug] AMX backtrace:
[19:18:22] [debug] #0 native fread () from samp-server.exe
[19:18:22] [debug] #1 003035b8 in ?? () at C:\Users\Shitcomputer\Desktop\Server\gamemodes\ScavengeSurvive.pwn:615
[19:18:22] [debug] #2 0000f540 in public ScriptInit_OnGameModeExit () at C:\Users\Shitcomputer\Desktop\Server\pawno\include\YSI\y_hooks/impl.inc:516
[19:18:22] [debug] #3 00007674 in public OnGameModeExit () at C:\Users\Shitcomputer\Desktop\Server\pawno\include\YSI\internal\..\y_scriptinit.inc:269
[19:18:23] [debug] Native backtrace:
[19:18:23] [debug] #0 76eb77a2 in ?? () from C:\Windows\SYSTEM32\ntdll.dll
[19:18:23] [debug] #1 004943b0 in ?? () from samp-server.exe
[19:18:23] [debug] #2 004949e0 in ?? () from samp-server.exe
[19:18:23] [debug] #3 00404f14 in ?? () from samp-server.exe
Re: crashdetect -
Konstantinos - 23.04.2015
https://sampwiki.blast.hk/wiki/Fread
Read the "Warning" box because that's the reason your server crash.
There are also examples below it so you can understand how to prevent it (by checking if the file handle is valid).
PS: It's in the line 615.
Re: crashdetect -
FinStar - 23.04.2015
public OnGameModeExit()
{
print("\n[OnGameModeExit] Shutting down...");
new File:f = fopen("nonexistentfile", io_read), _s[1];
fread(f, _s);
// 615 Line
fclose(f);
return 1;
}
Re: crashdetect -
Konstantinos - 23.04.2015
PHP код:
new File:f = fopen("nonexistentfile", io_read), _s[1];
if (f)
{
fread(f, _s); // 615 Line
fclose(f);
}
Re: crashdetect -
FinStar - 24.04.2015
That did not work, the server still restarts
Re: crashdetect -
Konstantinos - 24.04.2015
Quote:
Originally Posted by FinStar
That did not work, the server still restarts
|
There is a difference between server crash and server restart. File functions crash the server with invalid handles. If the file was not opened correctly, it'll just not write/read and close the file to prevent it (that's what the code does).
If your server restarting for an unknown reason, the problem is somewhere else.