Jump to content

[crash] Waypoints


Auntie Mangos

Recommended Posts

9435

../game/libmangosgame.a(CreatureAIRegistry.o): In function `MovementGeneratorMedium<Creature, WaypointMovementGenerator<Creature> >::GetResetPosition(Unit&, float&, float&, float&)':

CreatureAIRegistry.cpp:(.text._ZN23MovementGeneratorMediumI8Creature25WaypointMovementGeneratorIS0_EE16GetResetPositionER4UnitRfS6_S6_[MovementGeneratorMedium<Creature, WaypointMovementGenerator<Creature> >::GetResetPosition(Unit&, float&, float&, float&)]+0x15): undefined reference to `DestinationHolder<Traveller<Creature> >::GetLocationNowNoMicroMovement(float&, float&, float&) const'

collect2: ld returned 1 exit status

make[3]: *** [mangos-worldd] Ошибка 1

make[3]: Leaving directory `/server/Mangos-Sources/compile/compile-9435-/objdir/src/mangosd'

:mad:

Link to comment
Share on other sites

  • Replies 73
  • Created
  • Last Reply

Top Posters In This Topic

if we look at code we see

if (creature.IsStopped()){ - look at this check
....
MovementInform(creature);
}

and after

if (i_nextMoveTime.Passed())
   {
       // If stopped then begin a new move segment
       if (creature.IsStopped()) - the same check
       {
        ....
       }
       else
      {
          ....
           i_nextMoveTime.Reset(i_path->at(i_currentNode).delay); - there was crash, because i_past = null;
           ...
       }

if first check passed, crash code can't be call

so making check i_path after MovementInform(creature); as in [9434] doesn't help

looks like it's deleted from other thread, but creatures on what was crash don't have eventAI or SD2 scripts

PS sorry for my bad english

Link to comment
Share on other sites

"looks like it's deleted from other thread" this is impossible in current core. Diff map-threads not supported...

i_path changes only in WaypointMovementGenerator<Creature>::LoadPath and in WaypointMovementGenerator<Creature>::ClearWaypoints()

ClearWaypoints called from ReloadPath not used in clean code now. So or object deleted or LoadPath called somewhere

But in single thread if Update called this possible only after MovementInform... :( Where deleting/NULL cases checked....

Link to comment
Share on other sites

DrKLO, I think you need add thread id in Log... It's very helpful debug MT... And it's will arguments for your words... (sorry for English)

@@ -20,10 +20,11 @@
#include "Log.h"
#include "Policies/SingletonImp.h"
#include "Config/ConfigEnv.h"
#include "Util.h"
#include "ByteBuffer.h"
+#include "ace/Thread_Manager.h"

#include <stdarg.h>

INSTANTIATE_SINGLETON_1( Log );

@@ -287,11 +288,11 @@ void Log::outTimestamp(FILE* file)
    //       MM     month (2 digits 01-12)
    //       DD     day (2 digits 01-31)
    //       HH     hour (2 digits 00-23)
    //       MM     minutes (2 digits 00-59)
    //       SS     seconds (2 digits 00-59)
-    fprintf(file,"%-4d-%02d-%02d %02d:%02d:%02d ",aTm->tm_year+1900,aTm->tm_mon+1,aTm->tm_mday,aTm->tm_hour,aTm->tm_min,aTm->tm_sec);
+    fprintf(file,"%-4d-%02d-%02d %02d:%02d:%02d %d ",aTm->tm_year+1900,aTm->tm_mon+1,aTm->tm_mday,aTm->tm_hour,aTm->tm_min,aTm->tm_sec, ACE_Thread::self());
}

void Log::outTime()
{
    time_t t = time(NULL);
@@ -300,11 +301,11 @@ void Log::outTime()
    //       MM     month (2 digits 01-12)
    //       DD     day (2 digits 01-31)
    //       HH     hour (2 digits 00-23)
    //       MM     minutes (2 digits 00-59)
    //       SS     seconds (2 digits 00-59)
-    printf("%02d:%02d:%02d ",aTm->tm_hour,aTm->tm_min,aTm->tm_sec);
+    printf("%02d:%02d:%02d %d ",aTm->tm_hour,aTm->tm_min,aTm->tm_sec, ACE_Thread::self());
}

std::string Log::GetTimestampStr()
{
    time_t t = time(NULL);

PS: And we all understood that current realization of core (single thread) is "die". Have you a plans about it?

Link to comment
Share on other sites

But DrKLO said that SD2 starting in other thread in current realization of core, but it's need check.

i say that it's look like, not sure

Vladimir, can after MovementInform(creature); - creature.IsStopped() become false?

Russian:

Если не может, то краш точно не из за этого, т.к. краш только тогда, когда creature.IsStopped() = false.

Link to comment
Share on other sites

CreatureTraveller traveller(creature);

i_nextMoveTime.Update(diff);
i_destinationHolder.UpdateTraveller(traveller, diff, false, true); -this

function DestinationHolder<TRAVELLER>::UpdateTraveller
...
traveller.Relocation(x, y, z, ori); - in some cases - this

template<>
inline void Traveller<Creature>::Relocation(float x, float y, float z, float orientation)
{
   i_traveller.GetMap()->CreatureRelocation(&i_traveller, x, y, z, orientation);
}

void
Map::CreatureRelocation(Creature *creature, float x, float y, float z, float ang)
...
// if creature can't be move in new cell/grid (not loaded) move it to repawn cell/grid
// creature coordinates will be updated and notifiers send
if(!CreatureRespawnRelocation(creature)) - this

bool Map::CreatureRespawnRelocation(Creature *c)
...
c->GetMotionMaster()->Clear(); - this

in 9400-9401 there was added some changes in CreatureRelocation, and maybe some of this changes delete WaypointMovementGenerator? so we have crash, and i_path = 0

Link to comment
Share on other sites

if someone compile source with #define MANGOS_DEBUG and enable logs, we should see what happened before crash in logs

maybe we should change in WaypointMovementGenerator.cpp this

// prevent a crash at empty waypoint path.
   if (!i_path || i_path->empty())
   {
       creature.clearUnitState(UNIT_STAT_ROAMING_MOVE);
       return true;
   }

   // i_path was modified by chat commands for example
   if (i_path->size() != i_hasDone.size())
       i_hasDone.resize(i_path->size());

   if (i_currentNode >= i_path->size())
       i_currentNode = 0;

and this

   CreatureTraveller traveller(creature);

   i_nextMoveTime.Update(diff);
   i_destinationHolder.UpdateTraveller(traveller, diff, false, true);

to avoid crash

Link to comment
Share on other sites

Hi guys, I just want to ask how frequent your server(s) are crashing. Just to find out if I'm having more issues (or not). Because I see lots of people who still reach 30 mins uptime.

My server often crashes after a few seconds, and around 4 minutes. Reaching 30 minutes is very rare at this moment, this is with around 300+ people while using the latest rev.

Link to comment
Share on other sites

I think the cause may be some use of method MotionMaster::Initialize(), that reloads WaypointMovementGenerator. It is an unsafe function (deletes every MG without the checks of Clear() or MovementExpired()), so should be called only in safe places.

This doesn't happen, for example, here or here:

Map.cpp, line 1026:

   // teleport it to respawn point (like normal respawn if player see)
   if(CreatureCellRelocation(c,resp_cell))
   {
       c->Relocate(resp_x, resp_y, resp_z, resp_o);
       c->GetMotionMaster()->Initialize();                 // prevent possible problems with default move generators
       c->SetNeedNotify();
       return true;
   }
   else
       return false;

There may be other points in code.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use