Random Server Crash
#1

Hi there I have an issue where the server is crashing whilst unloading a filterscript and loading another.

PHP код:
forward ExitMission(); // Unloads the current filterscript.
public ExitMission()
{
    
CallRemoteFunction("UnloadMission""s""mission84");

In the main Gamemode;
PHP код:
forward UnloadMission(params[]);
public 
UnloadMission(params[])
{
    foreach(new 
Player)
    {
        
HideSpawnLogo(i);
        
SetTimerEx("SendPlayerToWelcomeScreen"1false"d"i);
    }
    new 
string[30];
    
format(stringsizeof string"unloadfs %s"params);
    
SendRconCommand(string);
    
    
SendRconCommand("loadfs lobby");
    
MissionLoaded false;
    for(new 
06i++)
    {
        
SendDeathMessage(202202202);
    }
    return 
1;

The server then crashes for no apparent reason, here is the crash detect log;
PHP код:
[02:23:43]   Filterscript 'mission84.amx' unloaded.
[
02:23:43
[
02:23:43] --------------------------
[
02:23:43]  Lobby by Infamous [2015
[
02:23:43] --------------------------
[
02:23:43
[
02:23:43]   Filterscript 'lobby.amx' loaded.
[
02:23:43] [debugServer crashed due to an unknown error
[02:23:44] [debugNative backtrace:
[
02:23:44] [debug#0 00480452 in ?? () from samp-server.exe
[02:23:44] [debug#1 0048ceca in ?? () from samp-server.exe 
If anyone can see a problem or possibly has any ideas as to the cause of this problem then please let me know.

EDIT: Running through the crash again the crash detect plugin found a little bit more info;
PHP код:
[02:46:46]   Filterscript 'mission84.amx' unloaded.
[
02:46:46
[
02:46:46] --------------------------
[
02:46:46]  Lobby by Infamous [2015
[
02:46:46] --------------------------
[
02:46:46
[
02:46:46]   Filterscript 'lobby.amx' loaded.
[
02:46:46] [debugRun time error 7"Stack underflow"
[02:46:46] [debug]  Stack pointer (STKis 0x4D8BCstack top (STPis 0x7670
[02:46:46] [debugAMX backtrace:
[
02:46:46] [debug#0 00000000 in public Itter_OnPlayerDisconnect ()
[02:46:46] [debugServer crashed due to an unknown error
[02:46:46] [debugNative backtrace:
[
02:46:46] [debug#0 00480452 in ?? () from samp-server.exe
[02:46:46] [debug#1 0048ceca in ?? () from samp-server.exe 
Reply
#2

Try compiling in debug mode (-d3) then viewing the crashdetect log. Also try this with the log:
Код:
forward UnloadMission(params[]); 
public UnloadMission(params[]) 
{ 
    foreach(new i : Player) 
    { 
        HideSpawnLogo(i); 
        SetTimerEx("SendPlayerToWelcomeScreen", 1, false, "d", i); 
    } 

    new string[30]; 
    format(string, sizeof string, "unloadfs %s", params); 
    SendRconCommand(string); 
     
    SendRconCommand("loadfs lobby"); 
    MissionLoaded = false; 
    
    print("1");
    for(new i = 0; i < 6; i++) 
    { 
    	printf("Loop %i", i+1);
        SendDeathMessage(202, 202, 202); 
    } 
    print("2");
    return 1; 
}
Then we will know if it gets past the loop or not (I don't know why it wouldn't but let's be sure before drawing inconclusive solutions).
Reply
#3

Okay so the server hasn't actually crashed this time but it has flooded the server window with the following;

PHP код:
[03:27:23]   Filterscript 'lobby.amx' loaded.
[
03:27:231
[03:27:23Loop 1
[03:27:23Loop 2
[03:27:23Loop 3
[03:27:23Loop 4
[03:27:23Loop 5
[03:27:23Loop 6
[03:27:232
[03:27:23] [debugRun time error 7"Stack underflow"
[03:27:23] [debug]  Stack pointer (STKis 0x4D8BCstack top (STPis 0x7670
[03:27:23] [debugAMX backtrace:
[
03:27:23] [debug#0 00000000 in public Itter_OnPlayerDisconnect ()
[03:27:23] [debugRun time error 7"Stack underflow"
[03:27:23] [debug]  Stack pointer (STKis 0x4D8C4stack top (STPis 0x7670
[03:27:23] [debugAMX backtrace:
[
03:27:23] [debug#0 00000000 in public OnPlayerUpdate ()
[03:27:23] [debugRun time error 7"Stack underflow"
[03:27:23] [debug]  Stack pointer (STKis 0x4D8C0stack top (STPis 0x7670
[03:27:23] [debugAMX backtrace:
[
03:27:23] [debug#0 00000000 in public OnPlayerSpawn ()
[03:27:23] [debugRun time error 7"Stack underflow"
[03:27:23] [debug]  Stack pointer (STKis 0x4D8BCstack top (STPis 0x7670
[03:27:23] [debugAMX backtrace:
[
03:27:23] [debug#0 00000000 in public OnPlayerUpdate ()
[03:27:23] [debugRun time error 7"Stack underflow"
[03:27:23] [debug]  Stack pointer (STKis 0x4D8B8stack top (STPis 0x7670 
EDIT: So I made a manual /unload command which loads the lobby fs directly after and it doesn't display any issues. The only difference is that the command doesn't clean the server of textdraws and vehicles etc where are as the remote function does.

Here is the public called before the ExitMission callback is called just in-case it helps;
PHP код:
forward MissionFinished();
public 
MissionFinished()
{
    
GameOver true;
    foreach(new 
Player)
    {
         
ResetPlayerVars(i);
        
RemovePlayerMapIcon(i0);
        
RemovePlayerMapIcon(i1);
        
RemovePlayerMapIcon(i2);
        
RemovePlayerMapIcon(i3);
        
RemovePlayerMapIcon(i4);
        
KillTimer(BombPlantTimer[i]);
        
KillTimer(PanelHackTimer[i]);
        
TogglePlayerAllDynamicCPs(i0);
        
SetPlayerArmour(i0);
        
SetPlayerHealth(iFLOAT_INFINITY);
        
SetPlayerSpecialAction(iSPECIAL_ACTION_NONE);
        
DestroyDynamicPickup(Jetpack_Pickup);
        
Jetpack_Pickup INVALID_PICKUP_ID;
        
TogglePlayerControllable(i0);
        
PlayerTextDrawDestroy(iObjective[i]);
        
PlayerTextDrawDestroy(iSpectateTDx[i]);
    }
    
KillTimer(RoundTimerVar);
    
KillTimer(BombExplodeTimer);
    
TextDrawDestroy(RoundTimeTD);
    
TextDrawDestroy(SpawnLogo[0]);
    
TextDrawDestroy(SpawnLogo[1]);
    
TextDrawDestroy(SpawnLogo[2]);
    
TextDrawDestroy(SpectateTD[0]);
    
TextDrawDestroy(SpectateTD[1]);
    
TextDrawDestroy(SpectateTD[2]);
    
TextDrawDestroy(SpectateTD[3]);
    
TextDrawDestroy(SpectateTD[4]);
    
TextDrawDestroy(SpectateTD[5]);
    
TextDrawDestroy(SpectateTD[6]);
    
TextDrawDestroy(TeamMenuTD[0]);
    
TextDrawDestroy(TeamMenuTD[1]);
    
TextDrawDestroy(TeamMenuTD[2]);
    
TextDrawDestroy(TeamMenuTD[3]);
    
TextDrawDestroy(TeamMenuTD[4]);
    
TextDrawDestroy(TeamMenuTD[5]);
    
TextDrawDestroy(TeamMenuTD[6]);
    for(new 
vMAX_VEHICLESv++)
    {
        
DestroyVehicle(v);
    }
    
Streamer_DestroyAllItems(STREAMER_TYPE_OBJECT0);
    
SetTimer("ExitMission"60000); 
Reply
#4

Well it got passed the loop so it's obviously something that happens after UnloadMission is called. Show where you call that callback and the stuff beneath it.

Edit: Well, actually you need to show where (and underneath it) ExitMission is called since it calls UnloadMission.
Reply
#5

What version of foreach are you using?

Remember foreach tracks filterscript initializing.
Reply
#6

After UnloadMission is called the main gamemode sends the player to the welcome screen;
PHP код:
forward SendPlayerToWelcomeScreen(playerid);
public 
SendPlayerToWelcomeScreen(playerid)
{
    
SetPVarInt(playerid"viewing_welcome_screen"1);
    
SetPlayerVirtualWorld(playerid1);
    
SpawnPlayer(playerid);
    return 
1;

That then calls OnPlayerSpawn;
PHP код:
public OnPlayerSpawn(playerid)
{
    if(
GetPVarInt(playerid"viewing_welcome_screen") == 1)
    {
        
////////////////////////////////////////////////////////////////////
        
TogglePlayerSpectating(playeridtrue);
        
ShowWelcomeScreen(playerid);
        
////////////////////////////////////////////////////////////////////
        
if(GetPVarInt(playerid"playing_audio") == 0)
        {
            
PlayAudioStreamForPlayer(playerid"http://************/mowc5nw");
            
SetPVarInt(playerid"playing_audio"1);
        }
        
////////////////////////////////////////////////////////////////////
        
if(GetPVarInt(playerid"logged_in") == 0)
        {
            
format(SQL_Querysizeof(SQL_Query), "SELECT * FROM `player_accounts` WHERE Account_Name = '%s'"EscapeText(PlayerName(playerid)));
               
mysql_function_query(SQL_ConnectionSQL_Querytrue"CheckRegistered""i"playerid);
        }
        
////////////////////////////////////////////////////////////////////
    
}
    return 
1;

I'm already logged in so the main gamemode then does nothing else. The filterscript (lobby.pwn) then takes over and checks if the player is still on the welcome screen;
PHP код:
public OnPlayerUpdate(playerid)
{
    if(
GetPVarInt(playerid"viewing_welcome_screen") == 1)
    {
        if(
GetPVarInt(playerid"viewing_team_menu") == 0)
        {
            
SendPlayerToTeamSelection(playerid);
        }
    }
    return 
1;

Then should display the team selection menu but it's crashing before this happens.

EDIT: @Kar I'm using a slightly modified version of foreach 0.4.1: http://pastebin.com/FDy6SC64
Reply
#7

Why did you comment out the loadfs fix?

pawn Код:
//if (funcidx(YSI_gsOnPlayerDisconnect) != -1)
                //{
                //      YSI_g_sCallbacks |= 1;
                //}
//if (funcidx(YSI_gsOnPlayerConnect) != -1)
        //{
        //  YSI_g_sCallbacks |= 2;
        //}
Please try this version, it's 0.4.1 (17) with cleanups.

https://github.com/Kar2k/SAMP-foreac...ases/tag/v19.0
Reply
#8

I'm not actually sure what was changed in it, I got it from a friend as foreach wouldn't work in my filterscripts before hand.
Reply
#9

Quote:
Originally Posted by Infamous
Посмотреть сообщение
After UnloadMission is called the main gamemode sends the player to the welcome screen;
PHP код:
forward SendPlayerToWelcomeScreen(playerid);
public 
SendPlayerToWelcomeScreen(playerid)
{
    
SetPVarInt(playerid"viewing_welcome_screen"1);
    
SetPlayerVirtualWorld(playerid1);
    
SpawnPlayer(playerid);
    return 
1;

That then calls OnPlayerSpawn;
PHP код:
public OnPlayerSpawn(playerid)
{
    if(
GetPVarInt(playerid"viewing_welcome_screen") == 1)
    {
        
////////////////////////////////////////////////////////////////////
        
TogglePlayerSpectating(playeridtrue);
        
ShowWelcomeScreen(playerid);
        
////////////////////////////////////////////////////////////////////
        
if(GetPVarInt(playerid"playing_audio") == 0)
        {
            
PlayAudioStreamForPlayer(playerid"http://************/mowc5nw");
            
SetPVarInt(playerid"playing_audio"1);
        }
        
////////////////////////////////////////////////////////////////////
        
if(GetPVarInt(playerid"logged_in") == 0)
        {
            
format(SQL_Querysizeof(SQL_Query), "SELECT * FROM `player_accounts` WHERE Account_Name = '%s'"EscapeText(PlayerName(playerid)));
               
mysql_function_query(SQL_ConnectionSQL_Querytrue"CheckRegistered""i"playerid);
        }
        
////////////////////////////////////////////////////////////////////
    
}
    return 
1;

I'm already logged in so the main gamemode then does nothing else. The filterscript (lobby.pwn) then takes over and checks if the player is still on the welcome screen;
PHP код:
public OnPlayerUpdate(playerid)
{
    if(
GetPVarInt(playerid"viewing_welcome_screen") == 1)
    {
        if(
GetPVarInt(playerid"viewing_team_menu") == 0)
        {
            
SendPlayerToTeamSelection(playerid);
        }
    }
    return 
1;

Then should display the team selection menu but it's crashing before this happens.

EDIT: @Kar I'm using a slightly modified version of foreach 0.4.1: http://pastebin.com/FDy6SC64
Ok, keep the correct foreach. Now try putting debug messages all over every piece of code you just explained here. Then see how much of it prints before the crash occurs. Be sure to number them like we did before. Also put debug messages in the team selection area. I've searched for other stack underflow occurrences but it seems to be a rare case. Also maybe you should try the latest y_iterate (it requires YSI though).
Reply
#10

Okay thank you both for the advice, I'll keep going until I get this figured out.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)