azerothcore / mod-eluna

Eluna Lua Engine © for WoW Emulators
https://elunaluaengine.github.io/
GNU General Public License v3.0
96 stars 126 forks source link

Segmentation fault (m_time ++ diff?) on worldserver / Linux build / AC with NPCBots #160

Closed robertocsjr closed 8 months ago

robertocsjr commented 9 months ago

Hello everyone... I'm really sorry if this is not the place to try to solve this, but I've been searching every possible place for a way to solve my issue.

I have a Ubuntu 22.4 server and have been trying to run AC with NPCBots with some Lua scripts. I run the worldserver normally and, after some time (randomly), I get a Segmentation fault crash.

The log output is as follows:

Thread 8 "worldserver" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7f31f1bff640 (LWP 25186)]
0x000055b775944b6a in ElunaEventProcessor::Update (this=0x0, diff=2257412096) at /home/rdpuser/wow/AzerothCore-wotlk-with-NPCBots/modules/mod-eluna/src/LuaEngine/ElunaEventMgr.cpp:44
44      m_time += diff;
#0  0x000055b775944b6a in ElunaEventProcessor::Update (this=0x0, diff=2257412096) at /home/rdpuser/wow/AzerothCore-wotlk-with-NPCBots/modules/mod-eluna/src/LuaEngine/ElunaEventMgr.cpp:44
#1  0x000055b7758dc0c6 in Eluna_WorldObjectScript::OnWorldObjectUpdate (this=0x7f323bfce3f0, object=0x7f31868d6000, diff=2257412096) at /home/rdpuser/wow/AzerothCore-wotlk-with-NPCBots/modules/mod-eluna/src/ElunaLuaEngine_SC.cpp:920
#2  0x000055b7770fa6fa in ScriptMgr::OnWorldObjectUpdate(WorldObject*, unsigned int)::$_4::operator()(WorldObjectScript*) const (this=0x7f31f1bfb208, script=0x7f323bfce3f0) at /home/rdpuser/wow/AzerothCore-wotlk-with-NPCBots/src/server/game/Scripting/ScriptDefines/WorldObjectScript.cpp:67
#3  0x000055b7770fa6b2 in std::__invoke_impl<void, ScriptMgr::OnWorldObjectUpdate(WorldObject*, unsigned int)::$_4&, WorldObjectScript*>(std::__invoke_other, ScriptMgr::OnWorldObjectUpdate(WorldObject*, unsigned int)::$_4&, WorldObjectScript*&&) (__f=..., __args=@0x7f31f1bfb140: 0x7f323bfce3f0) at /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/invoke.h:61
#4  0x000055b7770fa642 in std::__invoke_r<void, ScriptMgr::OnWorldObjectUpdate(WorldObject*, unsigned int)::$_4&, WorldObjectScript*>(ScriptMgr::OnWorldObjectUpdate(WorldObject*, unsigned int)::$_4&, WorldObjectScript*&&) (__fn=..., __args=@0x7f31f1bfb140: 0x7f323bfce3f0) at /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/invoke.h:111
#5  0x000055b7770fa522 in std::_Function_handler<void (WorldObjectScript*), ScriptMgr::OnWorldObjectUpdate(WorldObject*, unsigned int)::$_4>::_M_invoke(std::_Any_data const&, WorldObjectScript*&&) (__functor=..., __args=@0x7f31f1bfb140: 0x7f323bfce3f0) at /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/std_function.h:290
#6  0x000055b7770faa35 in std::function<void (WorldObjectScript*)>::operator()(WorldObjectScript*) const (this=0x7f31f1bfb208, __args=0x7f323bfce3f0) at /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/std_function.h:590
#7  0x000055b7770fa988 in ExecuteScript<WorldObjectScript>(std::function<void (WorldObjectScript*)>) (executeHook=...) at /home/rdpuser/wow/AzerothCore-wotlk-with-NPCBots/src/server/game/Scripting/ScriptMgrMacros.h:63
#8  0x000055b7770f91ae in ScriptMgr::OnWorldObjectUpdate (this=0x55b7788fd450 <ScriptMgr::instance()::instance>, object=0x7f31868d6000, diff=2257412096) at /home/rdpuser/wow/AzerothCore-wotlk-with-NPCBots/src/server/game/Scripting/ScriptDefines/WorldObjectScript.cpp:65
#9  0x000055b7768d69db in WorldObject::Update (this=0x7f31868d6000, time_diff=2257412096) at /home/rdpuser/wow/AzerothCore-wotlk-with-NPCBots/src/server/game/Entities/Object/Object.cpp:1063
#10 0x000055b7768da342 in WorldObject::CanSeeOrDetect (this=0x7f31a27db000, obj=0x7f31868d6000, ignoreStealth=false, distanceCheck=false, checkAlert=false) at /home/rdpuser/wow/AzerothCore-wotlk-with-NPCBots/src/server/game/Entities/Object/Object.cpp:1740
#11 0x000055b776ab114f in Unit::_IsValidAttackTarget (this=0x7f31a27db000, target=0x7f31868d6000, bySpell=0x7f32389ee000, obj=0x0) at /home/rdpuser/wow/AzerothCore-wotlk-with-NPCBots/src/server/game/Entities/Unit/Unit.cpp:14645
#12 0x000055b777390946 in SpellInfo::CheckExplicitTarget (this=0x7f32389ee000, caster=0x7f31a27db000, target=0x7f31868d6000, itemTarget=0x0) at /home/rdpuser/wow/AzerothCore-wotlk-with-NPCBots/src/server/game/Spells/SpellInfo.cpp:1988
#13 0x000055b77733ceda in Spell::CheckCast (this=0x7f3186c95000, strict=true) at /home/rdpuser/wow/AzerothCore-wotlk-with-NPCBots/src/server/game/Spells/Spell.cpp:6012
#14 0x000055b776a82b16 in Unit::_UpdateAutoRepeatSpell (this=0x7f31a27db000) at /home/rdpuser/wow/AzerothCore-wotlk-with-NPCBots/src/server/game/Entities/Unit/Unit.cpp:4108
#15 0x000055b776a5bd07 in Unit::_UpdateSpells (this=0x7f31a27db000, time=0) at /home/rdpuser/wow/AzerothCore-wotlk-with-NPCBots/src/server/game/Entities/Unit/Unit.cpp:4017
#16 0x000055b776a5b572 in Unit::Update (this=0x7f31a27db000, p_time=0) at /home/rdpuser/wow/AzerothCore-wotlk-with-NPCBots/src/server/game/Entities/Unit/Unit.cpp:425
#17 0x000055b776852e7b in Creature::Update (this=0x7f31a27db000, diff=0) at /home/rdpuser/wow/AzerothCore-wotlk-with-NPCBots/src/server/game/Entities/Creature/Creature.cpp:747
#18 0x000055b776d13425 in Acore::ObjectUpdater::Visit<Creature> (this=0x7f31f1bfd400, m=...) at /home/rdpuser/wow/AzerothCore-wotlk-with-NPCBots/src/server/game/Grids/Notifiers/GridNotifiers.cpp:395
#19 0x000055b776ee0a7d in VisitorHelper<Acore::ObjectUpdater, Creature> (v=..., c=...) at /home/rdpuser/wow/AzerothCore-wotlk-with-NPCBots/src/common/Dynamic/TypeContainerVisitor.h:44
#20 0x000055b776ee0a3d in VisitorHelper<Acore::ObjectUpdater, Creature, TypeList<DynamicObject, TypeList<Corpse, TypeNull> > > (v=..., c=...) at /home/rdpuser/wow/AzerothCore-wotlk-with-NPCBots/src/common/Dynamic/TypeContainerVisitor.h:50
#21 0x000055b776ee09de in VisitorHelper<Acore::ObjectUpdater, GameObject, TypeList<Creature, TypeList<DynamicObject, TypeList<Corpse, TypeNull> > > > (v=..., c=...) at /home/rdpuser/wow/AzerothCore-wotlk-with-NPCBots/src/common/Dynamic/TypeContainerVisitor.h:51
#22 0x000055b776ee099d in VisitorHelper<Acore::ObjectUpdater, TypeList<GameObject, TypeList<Creature, TypeList<DynamicObject, TypeList<Corpse, TypeNull> > > > > (v=..., c=...) at /home/rdpuser/wow/AzerothCore-wotlk-with-NPCBots/src/common/Dynamic/TypeContainerVisitor.h:57
#23 0x000055b776ee0960 in TypeContainerVisitor<Acore::ObjectUpdater, TypeMapContainer<TypeList<GameObject, TypeList<Creature, TypeList<DynamicObject, TypeList<Corpse, TypeNull> > > > > >::Visit (this=0x7f31f1bfd3f8, c=...) at /home/rdpuser/wow/AzerothCore-wotlk-with-NPCBots/src/common/Dynamic/TypeContainerVisitor.h:91
#24 0x000055b776ee092d in Grid<Player, TypeList<GameObject, TypeList<Player, TypeList<Creature, TypeList<Corpse, TypeList<DynamicObject, TypeNull> > > > >, TypeList<GameObject, TypeList<Creature, TypeList<DynamicObject, TypeList<Corpse, TypeNull> > > > >::Visit<Acore::ObjectUpdater> (this=0x7f31c3320098, visitor=...) at /home/rdpuser/wow/AzerothCore-wotlk-with-NPCBots/src/server/game/Grids/Grid.h:89
#25 0x000055b776ee0901 in NGrid<8u, Player, TypeList<GameObject, TypeList<Player, TypeList<Creature, TypeList<Corpse, TypeList<DynamicObject, TypeNull> > > > >, TypeList<GameObject, TypeList<Creature, TypeList<DynamicObject, TypeList<Corpse, TypeNull> > > > >::VisitGrid<Acore::ObjectUpdater, TypeList<GameObject, TypeList<Creature, TypeList<DynamicObject, TypeList<Corpse, TypeNull> > > > > (this=0x7f31c331d9c0, x=2, y=6, visitor=...) at /home/rdpuser/wow/AzerothCore-wotlk-with-NPCBots/src/server/game/Grids/NGrid.h:152
#26 0x000055b776ece147 in Map::Visit<Acore::ObjectUpdater, TypeMapContainer<TypeList<GameObject, TypeList<Creature, TypeList<DynamicObject, TypeList<Corpse, TypeNull> > > > > > (this=0x7f3203bd1340, cell=..., visitor=...) at /home/rdpuser/wow/AzerothCore-wotlk-with-NPCBots/src/server/game/Maps/Map.h:904
#27 0x000055b776eb727a in Map::VisitNearbyCellsOf (this=0x7f3203bd1340, obj=0x7f31a27db000, gridVisitor=..., worldVisitor=...) at /home/rdpuser/wow/AzerothCore-wotlk-with-NPCBots/src/server/game/Maps/Map.cpp:758
#28 0x000055b776eb757f in Map::Update (this=0x7f3203bd1340, t_diff=0, s_diff=1556) at /home/rdpuser/wow/AzerothCore-wotlk-with-NPCBots/src/server/game/Maps/Map.cpp:805
#29 0x000055b776ef53a1 in MapUpdateRequest::call (this=0x7f3198107c00) at /home/rdpuser/wow/AzerothCore-wotlk-with-NPCBots/src/server/game/Maps/MapUpdater.cpp:44
#30 0x000055b776ef47f9 in MapUpdater::WorkerThread (this=0x55b7788fc488 <MapMgr::instance()::instance+224>) at /home/rdpuser/wow/AzerothCore-wotlk-with-NPCBots/src/server/game/Maps/MapUpdater.cpp:156
#31 0x000055b776ef651e in std::__invoke_impl<void, void (MapUpdater::*)(), MapUpdater*> (__f=@0x7f31fcd5c6f0: (void (MapUpdater::*)(MapUpdater * const)) 0x55b776ef4770 <MapUpdater::WorkerThread()>, __t=@0x7f31fcd5c6e8: 0x55b7788fc488 <MapMgr::instance()::instance+224>) at /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/invoke.h:74
#32 0x000055b776ef6432 in std::__invoke<void (MapUpdater::*)(), MapUpdater*> (__fn=@0x7f31fcd5c6f0: (void (MapUpdater::*)(MapUpdater * const)) 0x55b776ef4770 <MapUpdater::WorkerThread()>, __args=@0x7f31fcd5c6e8: 0x55b7788fc488 <MapMgr::instance()::instance+224>) at /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/invoke.h:96
#33 0x000055b776ef63f2 in std::thread::_Invoker<std::tuple<void (MapUpdater::*)(), MapUpdater*> >::_M_invoke<0ul, 1ul> (this=0x7f31fcd5c6e8) at /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/std_thread.h:259
#34 0x000055b776ef63a5 in std::thread::_Invoker<std::tuple<void (MapUpdater::*)(), MapUpdater*> >::operator() (this=0x7f31fcd5c6e8) at /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/std_thread.h:266
#35 0x000055b776ef6209 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (MapUpdater::*)(), MapUpdater*> > >::_M_run (this=0x7f31fcd5c6e0) at /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/std_thread.h:211
#36 0x00007f323e9a7253 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
#37 0x00007f323e630ac3 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#38 0x00007f323e6c2a40 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

Unfortunately, I've been unable to find anyone that have experienced the same issue (I may be searching the wrong way) If you could shed some light on what migh be the issue, I would greatly appreciate.

Thanks

r-o-b-o-t-o commented 9 months ago

What revision of AzerothCore and Eluna are you running?

robertocsjr commented 8 months ago

Hi r-o-b-o-t-o, sorry for the long delay...

I've been delving a little bit deeply in the issue and the issue turned out to be related to NPCBots. The issue was introduced when AC implemented Grid Unload, and the crash happened when the grid was unloaded with bots inside.

Sorry for the wrong report. BR.

55Honey commented 8 months ago

Thanks for the update 👍