PDA

View Full Version : Periodic Client XTargeting crash w/bots and large pulls


irongut_av
11-15-2018, 10:04 AM
I have the latest source, and see an infrequent crash in some zones when the bot owner client aggro list gets large. Client::AddAutoXTarget has a comment that "IT IS NOT SAFE TO CALL THIS IF IT'S NOT INITIAL AGGRO", perhaps with bots and large pulls / train of mobs pushes the iterator too high.



[11-13-2018 :: 23:57:32] [Crash] EXCEPTION_ACCESS_VIOLATION
...

[11-13-2018 :: 23:57:33] [Crash] g:\eq\server\zone\client.cpp (7376): Client::AddAutoXTarget
[11-13-2018 :: 23:57:33] [Crash] g:\eq\server\zone\attack.cpp (2993): Mob::AddToHateList
[11-13-2018 :: 23:57:33] [Crash] g:\eq\server\zone\aggro.cpp (520): EntityList::AIYellForHelp
[11-13-2018 :: 23:57:33] [Crash] g:\eq\server\zone\npc.cpp (815): NPC::Process
[11-13-2018 :: 23:57:33] [Crash] g:\eq\server\zone\entity.cpp (487): EntityList::MobProcess
[11-13-2018 :: 23:57:33] [Crash] g:\eq\server\zone\net.cpp (511): <lambda_1c9bf3832c89b368be380b0fbdc8d329>::operator()
[11-13-2018 :: 23:57:33] [Crash] c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.15.26726 \include\functional (15732480): std::_Func_impl_no_alloc<<lambda_1c9bf3832c89b368be380b0fbdc8d329>,void,EQ::Timer *>::_Do_call
[11-13-2018 :: 23:57:33] [Crash] g:\eq\server\common\event\timer.h (39): <lambda_4a62a3c5557233412b20b69a12aafc23>::<lambda_invoker_cdecl>
[11-13-2018 :: 23:57:33] [Crash] g:\eq\server\libs\libuv\src\win\timer.c (193): uv_process_timers
[11-13-2018 :: 23:57:33] [Crash] g:\eq\server\libs\libuv\src\win\core.c (496): uv_run
[11-13-2018 :: 23:57:33] [Crash] g:\eq\server\zone\net.cpp (538): main
[11-13-2018 :: 23:57:33] [Crash] f:\dd\vctools\crt\vcstartup\src\startup\exe_common .inl (288): __scrt_common_main_seh
[11-13-2018 :: 23:57:33] [Crash] ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 7664343D)
[11-13-2018 :: 23:57:33] [Crash] 7664343D (kernel32): (filename not available): BaseThreadInitThunk
[11-13-2018 :: 23:57:33] [Crash] ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 77479802)
[11-13-2018 :: 23:57:33] [Crash] 77479802 (ntdll): (filename not available): RtlInitializeExceptionChain
[11-13-2018 :: 23:57:33] [Crash] ERROR: SymGetLineFromAddr64, GetLastError: 487 (Address: 774797D5)
[11-13-2018 :: 23:57:33] [Crash] 774797D5 (ntdll): (filename not available): RtlInitializeExceptionChain

prestanneth
11-15-2018, 08:47 PM
More than 20 perchance?

You could try adding ->AddAutoXTarget(this ,false);
rather than spamming the call but the MaxXTargets might be the problem..

irongut_av
11-26-2018, 03:13 PM
I tried both solutions, and the crashes continued.

Finally found out what is causing the crash: the very small time that bots and bot pets remain in the zone after a client is killed.

Adding a these checks to attack.cpp stoped all crashes with bots and large pulls / train deaths:



#ifdef BOTS
// if other is a bot, add the bots client to the hate list
if(
other->IsBot()
&& other->CastToBot()->GetBotOwner() // valid pointer
&& other->CastToBot()->GetBotOwner()->InZone() // is in zone
&& !other->CastToBot()->GetBotOwner()->CastToClient()->IsDead() // isn't dead from the train
)
{

// do stuff to add aggro to bot owning client
}

Uleat
11-26-2018, 09:10 PM
Can you specify a line number per: https://github.com/EQEmu/Server/blob/master/zone/attack.cpp?

irongut_av
11-27-2018, 02:32 PM
https://github.com/EQEmu/Server/blob/master/zone/attack.cpp?#L2697

Uleat
11-27-2018, 08:10 PM
[11-11-2018 :: 08:47:10] [Crash] c:\git-eqemusource\server\zone\client.cpp (7376): Client::AddAutoXTarget
[11-11-2018 :: 08:47:10] [Crash] c:\git-eqemusource\server\zone\attack.cpp (2711): Mob::AddToHateList
[11-11-2018 :: 08:47:10] [Crash] c:\git-eqemusource\server\zone\spell_effects.cpp (3482): Mob::DoBuffTic
[11-11-2018 :: 08:47:10] [Crash] c:\git-eqemusource\server\zone\spell_effects.cpp (3386): Mob::BuffProcess
[11-11-2018 :: 08:47:10] [Crash] c:\git-eqemusource\server\zone\npc.cpp (670): NPC::Process
[11-11-2018 :: 08:47:10] [Crash] c:\git-eqemusource\server\zone\entity.cpp (487): EntityList::MobProcess

I had a singular crash that led me to that exact code segment. (Happened during a client death..)

I'll look over what you posted and see what can be done.

Uleat
12-19-2018, 07:16 PM
I re-worked it a little..but, I did finally push your change - thanks!!