Page 1 of 1

Player 'Seriak'

Posted: Mon Oct 31, 2011 8:23 am
by John Adams
I don't know who this is, so hopefully they read the forum.

Please keep doing whatever it is you are doing to cause deadlocks and exceptions on EQ2TC. I almost have this bug identified, but unfortunately, it seems to only happen to you. I think it is logwrite() related, so I keep trying different things to corner it.

Thanks for your patience.

Re: Player 'Seriak'

Posted: Mon Oct 31, 2011 8:39 am
by John Adams
Scatman,

This is one of the log entries that was causing an exception and crashing the entire world:

Code: Select all

LogWrite(NPC__DEBUG, "NPC", "'%s' engaged in combat with '%s'", this->GetName(), GetTarget()->GetName());
When I mouse over GetTarget()->GetName(), there was no value on the GetName(), assuming there should be.

So I tried changing the parameter:

Code: Select all

LogWrite(NPC__DEBUG, "NPC", "'%s' engaged in combat with '%s'", this->GetName(), ( GetTarget()->GetName() ) ? GetTarget()->GetName() : "Unknown" );
Tried testing if it was valid, and if no value, print "Unknown" but that seemed to cause the zone to crash, and then a deadlock probably coming out of a spell cast.
21:03:57 D LUA: Found LUA Spell Script: 'Spells/Fighter/Crusader/Shadowknight/CondemningSmite.lua'
21:03:57 D Combat: DamageType: Disease (8), Amt: 1.00
21:03:57 D Combat: Setting LockedNoLoot to 3 for 'a wilderbear cub'
21:03:57 D Combat: Setting InCombat 'True' for 'a wilderbear cub'
21:03:57 E Zone: Exception while running 'OutpostOverlord'
21:03:57 D Guilds: Guild::GetGuildMember: 71
21:03:57 D Guilds: Sent guild member to a client.
21:03:57 D Guilds: Guild Member logged out.
21:03:57 I Zone: Scheduling client 'Seriak' for removal.
21:03:57 D Player: Toggling Character OFFLINE!
21:04:12 D World: Removing connection...
21:04:29 E Mutex: Possible deadlock attempt by 'SpellProcess::MSpellProcess'!
21:04:29 I Zone: Initiating zone shutdown of 'OutpostOverlord'
21:04:33 I Zone: Completed zone shutdown of 'OutpostOverlord'
So the question is, how can I "test" that a value is valid before attempting to shove it into a log entry? Test it first, set another var, and pass that? I can't do it in-line?


The InCombat() call is where the offending logger is in NPC.cpp.

Re: Player 'Seriak'

Posted: Mon Oct 31, 2011 5:43 pm
by Scatman
Make sure that GetTarget() is not null instead of GetTarget()->GetName(). A spawn will always have a name, but a spawn may not necessarily always have a target. When a NPC does not have a target, GetTarget() will return null.

Re: Player 'Seriak'

Posted: Tue Nov 01, 2011 6:44 am
by John Adams
That makes sense, but is kinda odd. How would the code be senting NPC '%s' into combat with '%s' if the NPC doesn't have the player (or other NPC) targeted? Is this a bug, or the fact this InCombat() check is done before targeting takes place (ie., multiple thread business)?

Thanks, Scatto! So just check the GetTarget() not the GetName(). I'll give that a try.

Re: Player 'Seriak'

Posted: Tue Nov 01, 2011 2:54 pm
by Scatman
InCombat() just sets whether or not the player is in combat (plus some other stuff like scripts and visual icons on the client). So there is always a possibility the NPC is not in combat before or after the NPC acquires a target. I'm sure there's cases where a NPC can be put into combat without even having a target too.

Re: Player 'Seriak'

Posted: Tue Nov 01, 2011 5:57 pm
by talinorcoldwind
Np I will keep logging in and playing all I am doing is playing not doing anything special. I am still having problems with my quest jurnal though it wont open.