Crashdetector.
#1

So i did post a thread where i was asking for help on my samp server freezing. I got a few responses and some of them told me to get crashdetector. I did get it and now my server is still freezing and crash detector is giving me these messages:

[17:07:06] [debug] Server received interrupt signal while executing script.amx
[17:07:06] [debug] AMX backtrace:
[17:07:06] [debug] #0 native fclose () in samp-server.exe
[17:07:06] [debug] #1 000305e0 in ?? () in script.amx
[17:07:06] [debug] #2 0034d608 in public @yT_180000_SaveUpdate () in script.amx
[17:07:06] [debug] Native backtrace:
[17:07:06] [debug] #0 776bf66c in ?? () in C:\WINDOWS\SYSTEM32\ntdll.dll
[17:07:06] [debug] #1 0049f892 in ?? () in samp-server.exe
[17:07:06] [debug] #2 00499361 in ?? () in samp-server.exe
[17:07:06] [debug] #3 004056cd in ?? () in samp-server.exe
[17:07:06] [debug] #4 7282dc92 in ?? () in plugins\crashdetect.dll
[17:07:06] [debug] #5 72835318 in ?? () in plugins\crashdetect.dll
[17:07:06] [debug] #6 728297cc in ?? () in plugins\crashdetect.dll
[17:07:06] [debug] #7 7282dcf4 in ?? () in plugins\crashdetect.dll
[17:07:06] [debug] #8 717712de in ?? () in plugins\profiler.dll
[17:07:06] [debug] #9 7176bb3a in ?? () in plugins\profiler.dll
[17:07:06] [debug] #10 00482a68 in ?? () in samp-server.exe
[17:07:06] [debug] #11 004912ba in ?? () in samp-server.exe

And here's the SaveUpdate Timer that i do have on my script.

Timer:SaveUpdate[180000]()
{
foreach(Player, i)
{
if(GetPVarInt(i, "TempName") != 1 && gPlayerLogged[i])
{
PlayerInfo[i][pInt] = GetPlayerInterior(i);
PlayerInfo[i][pVW] = GetPlayerVirtualWorld(i);
GetPlayerIp(i, PlayerInfo[i][pIP], 32);
GetPlayerPos(i, PlayerInfo[i][pPos_x], PlayerInfo[i][pPos_y], PlayerInfo[i][pPos_z]);
GetPlayerFacingAngle(i, PlayerInfo[i][pPos_r]);
OnPlayerStatsUpdate(i);
}
}
SaveFactions();
SaveFactionsHQ();
SaveHouses();
SaveBiz();
SaveGates();
SaveGarages();
}

Is there any issues with this timer or is there any issues with a certain include / plugin that does make my server freeze.
Reply
#2

File functions crash when an invalid file handle is passed to them and one of these functions is using fclose with an invalid handle:

pawn Код:
OnPlayerStatsUpdate(i);
SaveFactions();
SaveFactionsHQ();
SaveHouses();
SaveBiz();
SaveGates();
SaveGarages();
The wiki page for fclose shows how to validate the handle after using fopen: https://sampwiki.blast.hk/wiki/Fclose
Reply
#3

So one of the fuctions is missing a .cfg file on the place where the should be saved right? ((non mysql script atm))
Reply
#4

https://pastebin.com/pTRfNaPT For anyone who might need the stocks of all of the stuff listed like SavaGarages Houses Bizz and shit here is a link. https://pastebin.com/pTRfNaPT
Reply
#5

Quote:
Originally Posted by codeine666
Посмотреть сообщение
So one of the fuctions is missing a .cfg file on the place where the should be saved right? ((non mysql script atm))
It could be the reason. You can use the compiler debug flag to get the exact line where the function crashes: https://github.com/Zeex/samp-plugin-...ith-debug-info

Edit: I looked at your code and you never validate if the handle returned by fopen is valid and you should definitely do that.
Reply
#6

@kvann if possible could you provide me an example on how to validate any of my handles that i did show you on the link if possible. Thank you for responses.
Reply
#7

Sure. I chose SaveHouses as an example since the code there is the most straightforward, but the idea remains the same everywhere, you just have to check if the handle isn't zero after using fopen.

Код:
stock SaveHouses()
{
    new
        szFileStr[1024],
        File: fHandle = fopen("houses.cfg", io_write);

    if(!fHandle) {
        return 0; // the handle is invalid for some reason, don't do anything else
    }
 
    for(new iIndex; iIndex < MAX_HOUSES; iIndex++) {
        format(szFileStr, sizeof(szFileStr), ...);
        fwrite(fHandle, szFileStr);
    }
    return fclose(fHandle);
}
Reply
#8

@kvann Thanks.
Reply
#9

Still freezes and shows the SaveUpdate Thing on the server console sadly
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)