TrinityCore / TrinityCore/TrinityCore
Crash GameEventMgr::RunSmartAIScripts
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 10.8k
- Forks
- 6.4k
- Avg merge
- 3d 16m
- Merged PRs (30d)
- 6
Description
Description
Crash: https://gist.github.com/Idoitbetter/5bfa39aae76442291831de20132f47c0
It is an old crash, it is not frequent, it occurs very rarely, there are old issues closed with the same crash.
https://github.com/TrinityCore/TrinityCore/issues/17587#issuecomment-234774828
in crashlog and crashlog of the issue appear event_id=33 (Dalaran: Minigob)
I will try to add a log to avoid the crash and log some info, but I'm not sure when it will happen again, as I've seen it 2 times in years
diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp
index ffe2ef39e7a..7a599462683 100644
--- a/src/server/game/Events/GameEventMgr.cpp
+++ b/src/server/game/Events/GameEventMgr.cpp
@@ class GameEventAIHookWorker
void Visit(std::unordered_map<ObjectGuid, Creature*>& creatureMap)
{
for (auto const& p : creatureMap)
if (p.second->IsInWorld() && p.second->IsAIEnabled())
p.second->AI()->OnGameEvent(_activate, _eventId);
}
void Visit(std::unordered_map<ObjectGuid, GameObject*>& gameObjectMap)
{
for (auto const& p : gameObjectMap)
+ {
if (p.second->IsInWorld())
- p.second->AI()->OnGameEvent(_activate, _eventId);
+ {
+ if (p.second->AI())
+ p.second->AI()->OnGameEvent(_activate, _eventId);
+ else
+ TC_LOG_ERROR("test.gameevent", "GameEventMgr::RunSmartAIScripts AI() Null: gameObjectMap debug info: %s", p.second->GetDebugInfo().c_str());
+ }
+ }
}
template<class T>
Expected behaviour
No crash
Steps to reproduce the problem
I don't know
Branch
3.3.5
TC rev. hash/commit
f418631de0c193772e24f379db5aafcc01f3fb6a
Operating system
Debian 10
Custom changes
None
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the crash gist and src/server/game/Events/GameEventMgr.cpp, especially GameEventAIHookWorker and the GameObject handling shown in the report. Investigate the rare event_id=33 path on the 3.3.5 branch; done means the null-AI crash cause is confirmed and a fix is validated, though the issue provides no reproduction steps or test to run.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100