jaredballou / insurgency-sourcemod

Fork of SourceMod 1.8 including my custom plugins to support Insurgency.
Other
70 stars 33 forks source link

respawn.smx (Invalid timer handle) #20

Open Toxsor opened 8 years ago

Toxsor commented 8 years ago

Line ending seems to change just before (error 1 or 3), not sure what that is, maybe reporting?

Metamod:Source version 1.10.7 SourceMod 1.7.3-dev+5294

All dependencies are met. insurgency.smx = 1.3.3 gamedata/insurgency.games.txt translations/insurgency.phrases.txt

L 04/19/2016 - 17:49:59: [SM] Native "KillTimer" reported: Invalid timer handle 6b340015 (error 3) L 04/19/2016 - 17:49:59: [SM] Displaying call stack trace for plugin "respawn.smx": L 04/19/2016 - 17:49:59: [SM] [0] Line 356, respawn.sp::KillRespawnTimer() L 04/19/2016 - 17:49:59: [SM] [1] Line 363, respawn.sp::CreateRespawnTimer() L 04/19/2016 - 17:49:59: [SM] [2] Line 347, respawn.sp::Event_PlayerDeath() L 04/19/2016 - 17:50:02: [SM] Native "KillTimer" reported: Invalid timer handle 50660223 (error 3) L 04/19/2016 - 17:50:02: [SM] Displaying call stack trace for plugin "respawn.smx": L 04/19/2016 - 17:50:02: [SM] [0] Line 356, respawn.sp::KillRespawnTimer() L 04/19/2016 - 17:50:02: [SM] [1] Line 363, respawn.sp::CreateRespawnTimer() L 04/19/2016 - 17:50:02: [SM] [2] Line 347, respawn.sp::Event_PlayerDeath() L 04/19/2016 - 17:50:03: [SM] Native "KillTimer" reported: Invalid timer handle 4f0a0019 (error 1) L 04/19/2016 - 17:50:03: [SM] Displaying call stack trace for plugin "respawn.smx": L 04/19/2016 - 17:50:03: [SM] [0] Line 356, respawn.sp::KillRespawnTimer() L 04/19/2016 - 17:50:03: [SM] [1] Line 363, respawn.sp::CreateRespawnTimer() L 04/19/2016 - 17:50:03: [SM] [2] Line 347, respawn.sp::Event_PlayerDeath() L 04/19/2016 - 17:50:03: [SM] Native "KillTimer" reported: Invalid timer handle 4d7c0262 (error 1) L 04/19/2016 - 17:50:03: [SM] Displaying call stack trace for plugin "respawn.smx": L 04/19/2016 - 17:50:03: [SM] [0] Line 356, respawn.sp::KillRespawnTimer() L 04/19/2016 - 17:50:03: [SM] [1] Line 363, respawn.sp::CreateRespawnTimer() L 04/19/2016 - 17:50:03: [SM] [2] Line 347, respawn.sp::Event_PlayerDeath() L 04/19/2016 - 17:50:04: [SM] Native "KillTimer" reported: Invalid timer handle 4d490019 (error 1) L 04/19/2016 - 17:50:04: [SM] Displaying call stack trace for plugin "respawn.smx": L 04/19/2016 - 17:50:04: [SM] [0] Line 356, respawn.sp::KillRespawnTimer() L 04/19/2016 - 17:50:04: [SM] [1] Line 363, respawn.sp::CreateRespawnTimer() L 04/19/2016 - 17:50:04: [SM] [2] Line 347, respawn.sp::Event_PlayerDeath() L 04/19/2016 - 17:50:06: [SM] Native "KillTimer" reported: Invalid timer handle 4c44025d (error 1) L 04/19/2016 - 17:50:06: [SM] Displaying call stack trace for plugin "respawn.smx": L 04/19/2016 - 17:50:06: [SM] [0] Line 356, respawn.sp::KillRespawnTimer() L 04/19/2016 - 17:50:06: [SM] [1] Line 363, respawn.sp::CreateRespawnTimer() L 04/19/2016 - 17:50:06: [SM] [2] Line 347, respawn.sp::Event_PlayerDeath()

sm_respawn_enabled "1" sm_respawn_delay "1.0" sm_respawn_counterattack "2" sm_respawn_count "5" sm_respawn_count_team2 "0" sm_respawn_count_team3 "5" sm_respawn_reset_each_objective "1"

jaredballou commented 8 years ago

Windows or Linux? Did you reload the respawn or insurgency plugins after they had loaded?

Toxsor commented 8 years ago

This is on Linux - Ubuntu 12.04LTS

Yes I have reloaded, the plugin does get some functionality but its not 100%, every so often I do see some bots respawn. This is on the latest update you pushed out today.

The previous update had no functionality that I could tell, the "sm_respawn" command does indeed work though, just not the automated respawn waves for bots.

Toxsor commented 8 years ago

My log files are significantly smaller after the latest update to respawn.smx, they used to be about 20-30Megabytes, now they are about 70% smaller, around 6-9MB so you seem to have fixed it but I do occasionally see:

L 05/06/2016 - 00:00:04: [SM] Native "KillTimer" reported: Invalid timer handle 6414026e (error 1) L 05/06/2016 - 00:00:04: [SM] Displaying call stack trace for plugin "respawn.smx": L 05/06/2016 - 00:00:04: [SM] [0] Line 356, respawn.sp::KillRespawnTimer() L 05/06/2016 - 00:00:04: [SM] [1] Line 363, respawn.sp::CreateRespawnTimer() L 05/06/2016 - 00:00:04: [SM] [2] Line 347, respawn.sp::Event_PlayerDeath()

jaredballou commented 8 years ago

Interesting. I am not seeing similar stuff here, can I get a bit more context? What happens before the bug, is a player dying or trying to spawn? Are you having the plugin crash and/or reloading it? Does that just happen when run from menu, or run from the console? Are you trying to spawn players before they have selected a class?

EBS-DarkD commented 8 years ago

I've got sourcemod working after my recent issues and have updated everything

SourceMod Version: 1.7.3-dev+5304 Metamod:Source version 1.10.6 respawn.smx 1.8.1 All dependencies are met. insurgency.smx = 1.3.5 gamedata/insurgency.games.txt translations/insurgency.phrases.txt

This is running on a linux hosted system (sorry don't know what version)

I've dumped my server console output in pastebin http://pastebin.com/DFNtu7NQ and also included the respawn.cfg and sourcemod/ metamod info at the bottom

Bots are set for 1 respawn which is reset per objective

Line 27, I kill 'BOT Aaron' Line 32, I kill 'BOT Aaron' again after he respawns (it works once for each bot/player automatically) Line 49, Took out the 1st objective, no counter attack Line 72, I kill 'BOT Aaron' for the first time heading toward the 2nd objective. From this point onwards it throws the error on every death. The error continues on to the next map, there is no 1 respawn before it breaks like I got the first time, and the errors only stop when I restart the server at which point we start all over again!

If you need any more info let me know what you need and how to get it

EBS-DarkD commented 8 years ago

I've been looking at the area of respawn.sp where it's saying there is a problem.

        } if (g_iSpawnTokens[client] > 0) {

            CreateRespawnTimer(client);
        }
    }
}

} public KillRespawnTimer(client) {

if (g_hRespawnTimer[client] != INVALID_HANDLE) {

    KillTimer(g_hRespawnTimer[client]);
    g_hRespawnTimer[client] = INVALID_HANDLE;
}

}

public CreateRespawnTimer(client) { KillRespawnTimer(client); g_hRespawnTimer[client] = CreateTimer(GetConVarFloat(sm_respawn_delay), RespawnPlayer2, client, TIMER_FLAG_NO_MAPCHANGE); }

Am I right in saying it's creating a timer for the respawn delay and it's trying to make sure there is no previous instance of the timer running for that person?

I've been reading up on the error and have tried replacing 'KillTimer' with 'CloseHandle' but I couldn't get it to compile properly on my PC and don't have the command line access to do it on my server.

EBS-DarkD commented 8 years ago

I've got this working by stopping the call to KillRespawnTimer and CreateRespawnTimer

I replaced the call to 'CreateRespawnTimer' in 'Event_PlayerDeath' with the 'CreateTimer' code on line 383


public Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast) { new client = GetClientOfUserId(GetEventInt(event, "userid")); new team = GetClientTeam(client);

if (GetConVarInt(sm_respawn_auto) == 1)
{
    if (IsClientInGame(client) && (team == TEAM_1 || team == TEAM_2))
    {
        if (TF2)
        {
            if ((GetEventInt(event, "death_flags") & TF_DEATHFLAG_DEADRINGER) == TF_DEATHFLAG_DEADRINGER)
                return;
            new RoundState:iRoundState = GameRules_GetRoundState();
            new bool:NoRespawn = (TF2_IsSuddenDeath() || TF2_IsArenaMap() || iRoundState == RoundState_GameOver || iRoundState == RoundState_TeamWin);
            if(NoRespawn)
            {
                return;
            }
        }
        new ncp = Ins_ObjectiveResource_GetProp("m_iNumControlPoints");
        new acp = Ins_ObjectiveResource_GetProp("m_nActivePushPointIndex");
        if (Ins_InCounterAttack() && ((acp+1) == ncp) && (GetConVarInt(sm_respawn_final_counterattack)))
        {
            if ((g_iSpawnTokens[client] < 1) && (GetConVarInt(sm_respawn_final_counterattack)) && (IsFakeClient(client)))
            {
                PrintToServer("[RESPAWN] Respawning %N with extra token due to FINAL counterattack infinity! ncp %d acp %d",client,ncp,acp);
                g_iSpawnTokens[client] = 1;
            }
        }
        else if (Ins_InCounterAttack() && (!GetConVarInt(sm_respawn_counterattack)) && (IsFakeClient(client)))
        {
            PrintToServer("[RESPAWN] Not respawning %N due to counterattack ncp %d acp %d",client,ncp,acp);
            return;

        } if (g_iSpawnTokens[client] > 0) 
        {
            PrintToServer("[RESPAWN] Respawning %N ncp %d acp %d",client,ncp,acp);
            CreateTimer(GetConVarFloat(sm_respawn_delay), RespawnPlayer2, client, TIMER_FLAG_NO_MAPCHANGE);
        }

    }
}

} public KillRespawnTimer(client) {

if (g_hRespawnTimer[client] != INVALID_HANDLE) 
{
    CloseHandle(g_hRespawnTimer[client]);
    g_hRespawnTimer[client] = INVALID_HANDLE;
}

}

public CreateRespawnTimer(client) { KillRespawnTimer(client); g_hRespawnTimer[client] = CreateTimer(GetConVarFloat(sm_respawn_delay), RespawnPlayer2, client, TIMER_FLAG_NO_MAPCHANGE);

}

I've dropped the full file in pastebin - http://pastebin.com/nZeVpjwu

EBS-DarkD commented 8 years ago

Just tested with all 8 human slots full & 24 bots, 1x respawn for the bots, 1x respawn in counter and infinite respawn on final counter. It is working a treat with no errors. Thanks for this plugin.

syaifulnizamyahya commented 8 years ago

@EBS-DarkD Is it possible for you to shared the compiled smx?

Thanks.

EBS-DarkD commented 8 years ago

I think this is the right one. Apologies if it's not as I've now been in work 28hrs due to two critical servers failing within 30 mins of each other yesterday. respawn.zip

syaifulnizamyahya commented 8 years ago

@EBS-DarkD Thank you very much. Hope you sorted out the failing servers.

syaifulnizamyahya commented 8 years ago

@EBS-DarkD Your fix works wonderfully. THanks.

By the way, is it possible to fix bot_spawn? I use respawn.smx to respawn bots. unfortunately, the bot spawn right in front of me.

EBS-DarkD commented 8 years ago

I don't think so as, if I understand it correctly, it relates to the navmesh and the bots will respawn where they're supposed to. I believe Jareds other respawn mod may address this.

What we've done is change our tactics. Don't push forward too fast (as they respawn behind you then) and try take the bots from a distance (especially when I turned suicide bombers on) to give room between you and the bots when they do respawn. Can be fun on CQB maps!

jaredballou commented 8 years ago

Is this still an issue with my latest version? If you want to submit a PR or patch, I'd gladly merge it.

EBS-DarkD commented 8 years ago

I have just moved and am sans decent internet at the minute so all updating and testing (and gaming) is on hold. Once my broadband gets installed, I'll have a play with your latest version and feedback.