EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Support::Windows Servers (https://www.eqemulator.org/forums/forumdisplay.php?f=587)
-   -   Zone Crash - If someone could test this (https://www.eqemulator.org/forums/showthread.php?t=40291)

provocating 12-24-2015 05:13 PM

Zone Crash - If someone could test this
 
Someone with newer source, if you could test this for me. I am thinking it will also be a crash in the latest source, no changes in this section. This is how to repeat the crash, at least for me.

Go to Sirens Grotto and use Call of Karana on either a Seahorse or Swordfish. Send the pet to attack a few creatures. While they are attacking run back up to dry land, anywhere will do. Let the pet eventually die. Exactly when the pet dies I get a zone crash at what would be line 1037 on the latest souce in mob_ai.cpp

Code:

                if (target->IsCorpse())
                {
                        RemoveFromHateList(this);
                        return;
                }


Uleat 12-24-2015 06:20 PM

I can't test it atm..but, you could try this as a fix:
Code:

zone/mob_ai.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/zone/mob_ai.cpp b/zone/mob_ai.cpp
index 79c4493..33df4e6 100644
--- a/zone/mob_ai.cpp
+++ b/zone/mob_ai.cpp
@@ -1031,6 +1031,9 @@ void Mob::AI_Process() {
                        }
                }
 
+                if (target && !hate_list.IsEntOnHateList(target))
+                        target = nullptr;
+
                if (!target)
                        return;


EDIT: That's just above where you posted from :)

It's possible for the ai target timer to not be ready in the 'else' clause from above and the code will flow through with the last target..

..which, if already destroyed, will cause an exception error when you try to dereference the pointer - testing for target->IsCorpse()

provocating 12-24-2015 06:48 PM

Added this above did fix it.

Code:

if (target && !hate_list.IsEntOnHateList(target))
                        target = nullptr;

So what are we doing here? What is the current target causing the error? I am guessing it is the charmed underwater mob that just died? The question though is why it only seems to happen when the charmed mob is underwater and the client is not.

Either way I am very appreciative it is fixed but I would really like to know more about what the cause was. If I am going to continue to learn the source I have to dig my heels in.

Uleat 12-24-2015 06:59 PM

Yeah, this is not the source of the issue...

It can probably happen with any mob at any time when it's using the Mob::AI_Process()..but, you found a way to reliably trigger it.


Basically, any time a mob is removed from another mob's hate_list, we really need to test that mob's current target against what was removed.

Most reasons wouldn't crash a server..but, would cause erratic behavior between affected mobs.


Gimme a few and I'll see what I can do to fix it more permanently..

provocating 12-24-2015 07:12 PM

I looked it over again and finally figured out what you were saying.

Quote:

It's possible for the ai target timer to not be ready in the 'else' clause from above and the code will flow through with the last target..
You are saying the timer on this line...

if(AItarget_check_timer->Check())

May would fail and fall through that if statement. Just curious, what about making that if statement into an if/else and making the target null in that else statement?

Uleat 12-24-2015 08:19 PM

Oh, you don't want to make it null..I suspect there would be a lot of 'pauses' in-game if mobs didn't have targets during their 'off-time' :P

Uleat 12-24-2015 08:27 PM

It 'looks' that the condition I would have added is already accounted for..
Code:

bool Mob::RemoveFromHateList(Mob* mob)
{
        SetRunAnimSpeed(0);
        bool bFound = false;
        if(IsEngaged())
        {
                bFound = hate_list.RemoveEntFromHateList(mob);
                if(hate_list.IsHateListEmpty())
                {
                        AI_Event_NoLongerEngaged();
                        zone->DelAggroMob();
                        if (IsNPC() && !RuleB(Aggro, AllowTickPulling))
                                ResetAssistCap();
                }
        }
        if(GetTarget() == mob)
        {
                SetTarget(hate_list.GetEntWithMostHateOnList(this));
        }

        return bFound;
}


I guess I'll have to check for direct manipulations of 'Mob::hate_list' to see if a GetTarget() check is made in those cases...

provocating 12-24-2015 11:04 PM

Okay let me know what needs to be done on this. I definitely do not want to forget that it is just a temporary fix.

Uleat 12-24-2015 11:21 PM

I may push that as a 'temporary' fix at some point..I just hate the idea of iterating that list on every pass through there, though...

provocating 12-25-2015 02:28 PM

Let me know if you do a permanent fix. Can you reply back to this post if you do?

I supposed I could instead catch it in the death event for a charmed mob.


All times are GMT -4. The time now is 06:38 PM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.