Server crashes with bots

Issue #113 closed
Kreegoth created an issue

Hello. These bots are awesome trickerer.

The problem is it seems that for some reason the server has crashed 4 times since implementing the patch. (Small server 5 to 6 players max)

In the console I saw something about game object values 56 instead of 36 or something then assert.

This crash only appeared after implementing the patch and updating a few revisions up in trinitycore. So I can't say for sure it is the bots but it seems to hang the server it doesn't full crash it just says stopped working ( need to find a workaround for that so restarter wil kick it too lol)

The times I've been online when I noticed it happen it either seems to be related to a bot dying or a bot killing a player as both times that happened right before the hang (enrage kill)

Can you possibly add a config option got enrage kill by bot as well as it would be nice to turn it off if possible.

I will update this once I'm home with a call stack from the crash and anything else you need to see If you let me know what else.

I can't be sure it is not a recent trinity core update either so maybe that will help you rule out the bots patch but since the timing of crash seems related I thought id post it.

EDIT*

//===================================================== Exception code: C0000005 ACCESS_VIOLATION Fault address: 017BF9E4 01:003EE9E4

Registers: EAX:0000024B EBX:01AF72F0 ECX:0FBD0D3D EDX:03D5DFD3 ESI:01AF7468 EDI:01AF74B8 CS:EIP:0023:017BF9E4 SS:ESP:002B:08A2E568 EBP:08A2F578 DS:002B ES:002B FS:0053 GS:002B Flags:00010212

Call stack: Address Frame Function SourceFile 017BF9E4 00000000 0001:003EE9E4 01460DD4 00000000 0001:0008FDD4 0175BCEB 00000000 0001:0038ACEB 017524E3 00000000 0001:003814E3 0175FE28 00000000 0001:0038EE28 01760FA7 00000000 0001:0038FFA7 01613F95 00000000 0001:00242F95 0165CBED 00000000 0001:0028BBED 01535E62 00000000 0001:00164E62 015FE57E 00000000 0001:0022D57E 015FE42E 00000000 0001:0022D42E 016483EE 00000000 0001:002773EE 0F387C03 00000000 ?invoke_i@ACE_Thread_Adapter@@EAEKXZ+93 0F387B3E 00000000 ?invoke@ACE_Thread_Adapter@@UAEKXZ+7E 0FBDC01D 00000000 __get_tlsindex+6F 0FBDC001 00000000 __get_tlsindex+53 7538338A 00000000 BaseThreadInitThunk+12 77039F72 00000000 RtlInitializeExceptionChain+63 77039F45 00000000 RtlInitializeExceptionChain+36 ======================== Local Variables And Parameters

Call stack: Address Frame Function SourceFile 017BF9E4 00000000 0001:003EE9E4

01460DD4 00000000 0001:0008FDD4

0175BCEB 00000000 0001:0038ACEB

017524E3 00000000 0001:003814E3

0175FE28 00000000 0001:0038EE28

01760FA7 00000000 0001:0038FFA7

01613F95 00000000 0001:00242F95

0165CBED 00000000 0001:0028BBED

01535E62 00000000 0001:00164E62

015FE57E 00000000 0001:0022D57E

015FE42E 00000000 0001:0022D42E

016483EE 00000000 0001:002773EE

0F387C03 00000000 ?invoke_i@ACE_Thread_Adapter@@EAEKXZ+93

0F387B3E 00000000 ?invoke@ACE_Thread_Adapter@@UAEKXZ+7E

0FBDC01D 00000000 __get_tlsindex+6F

0FBDC001 00000000 __get_tlsindex+53

7538338A 00000000 BaseThreadInitThunk+12

77039F72 00000000 RtlInitializeExceptionChain+63

77039F45 00000000 RtlInitializeExceptionChain+36

Comments (33)

  1. Kreegoth reporter

    Recompiled with Debug on...Here is the server output during the crash.

    Entities\Object\Object.cpp:308 in Object::GetUInt32Value ASSERTION FAILED:
    index < m_valuesCount || PrintIndexError(index, false)
    Trinity::Assert() debugging\errors.cpp: 29 + 0x12
    Object::GetUInt32Value()+0x4c [0x0]
    Unit::getLevel()+0x18 [0x0]
    ByteBuffer::operator+0x64f5 [0x0]
    bot_minion_ai::RezGroup() \ai\npcbots\bot_ai.cpp: 754 + 0x18
    paladin_bot::paladin_botAI::DoNonCombatActions() trinitycore\src\server\game\ai\npcbots\bot_paladin_ai.cpp
    411 + 0x27 paladin_bot::paladin_botAI::UpdateAI() trinitycore\src\server\game\ai\npcbots\bot_paladin_ai.cpp: 391 + 0x 0 Creature::Update()+0x783 [0x0] [0xa43e81] sqrtf()+0x34ec0c [0x0] sqrtf()+0x695482 [0x0] GridReference<Creature>::targetObjectDestroyLink() game\maps\mapupdater.cpp: 26 + 0 x1c DBCFileLoader::Record::getUInt() trinitycore\src\server\shared\threading\delayexecutor.cpp: 50 + 0xf ace_max<int>() \dep\acelite\ace\task.cpp: 260 + 0xf ace_max<int>()+0xb065 [0x0] ace_max<int>()+0xae73 [0x0] __ace_assert()+0x1fd8a [0x0] [0x63651] [0x63861] [0x1338a] [0x39f72] [0x39f45]
  2. trickerer repo owner

    Well, there is nothing obvious in this crash log, especially while there are no calls in RezGroup() func that could lead to getLevel() calls. I am also unable to reproduce this crash. Need to know if anyone can provide some more info.

    As for temporary solution, go to bot_ai.h:32, there is a row containing berserk spell id (46587). Replace it with 47769 (Suicide). If that will not prevent these crashes then problem is more complicated than it seems to be.

  3. Icey

    Starting Map System Starting NpcBot system...

    /home/battlestation/TrinityCore/src/server/game/AI/NpcBots/bot_ai.cpp:6318 in In itFaction ASSERTION FAILED: result ./worldserver(ZN6bot_ai11DefaultInitEv+0x8f) [0xf03d4f] ./worldserver(_ZN8Creature14AIM_InitializeEP10CreatureAI+0x136) [0xaff2b6] ./worldserver(_ZN8Creature10AddToWorldEv+0xe7) [0xb0c537] ./worldserver(_Z15AddObjectHelperI8CreatureEvR9CoordPairILj512EER14GridRefManage rIT_ERjP3MapPS5+0xbb) [0x100c8fb] ./worldserver(_ZN16ObjectGridLoader5VisitER14GridRefManagerI8CreatureE+0x1ef) [0 x100cccf] ./worldserver(_ZN16ObjectGridLoader5LoadNEv+0xaa) [0x100d30a] ./worldserver(_ZN3Map16EnsureGridLoadedERK4Cell+0x1eb) [0xd8d9bb] ./worldserver(_ZN3Map8LoadGridEff+0xb0) [0xd90060] ./worldserver(_ZN10MapManager10InitializeEv+0x8b7) [0xd7fc57] ./worldserver(_ZN5World23SetInitialWorldSettingsEv+0x46f9) [0xec1ee9] ./worldserver(_ZN6Master3RunEv+0xf47) [0x9dd387] ./worldserver(main+0x23e) [0x96002e] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed) [0x7fd37e8e776d] ./worldserver() [0x9c4c9d]

    Segmentation fault (core dumped) #######@ubuntu:~/server/bin$

  4. trickerer repo owner

    @iceyman this crash means your npcbot got corrupted (exists in 'creature' table but not in 'characters_npcbot' table). delete it from 'creature' table. Did you delete npcbot from 'characters_npcbot' table by yourself (not by command)?

  5. Kreegoth reporter

    I found the line that lead to the crash in my logs.

    Attempt to get value from non-existed value field: 54 (count : 36) for object typed : 7 type mask: 129.

    To further report though I can't say it was bots code causing it I did roll back to old bots code with no other changes and crashes stopped completely.

    So I'm at a loss.

    Will try to clean up db recompile newest bot code with newest trinity and reproduce.

  6. Icey

    @trickerer i just did the How To: NPCBots and remove by what commands as i have old one installed and read the how to

  7. trickerer repo owner

    @iceyman Damn, I don't like this whole situation. When bots are being loaded, core selects them from characters_npcbot table before adding creature to world, so these assertions are guaranteed to pass through. And the only place where insert/delete npcbot queries are used is commands script.

    About commands: you are not supposed to add/delete npcbots using .npc commands and you are not supposed to add/delete entries from 'charaters_npcbot' or 'creature' tables.

    Now back to your problem. If you ever encounter this crash again, try this:
    go to bot_ai.cpp::bot_minion_ai::InitFaction() and find next row:

        stmt->setUInt32(0, me->GetEntry());
    

    and replace it with:

        stmt->setUInt32(0, me->GetCreatureTemplate()->Entry);
    

    to see if server will crash on InitFaction() or maybe at InitOwner().

  8. Kreegoth reporter

    Just finished compile with brand new database and it's running ATM. I'll let you know if any crashes. Quick question.

    I used a new world db and it is telling me for a lot of them that they are already spawned but they are not as it's a new creature table. Is there a query I can run to check which bots are listed as spawned but are not in world?

  9. trickerer repo owner
    SELECT ct.entry, ct.name, ct.subname, ct.trainer_class, ct.trainer_race FROM world.creature_template ct
    JOIN characters.characters_npcbot cn ON cn.entry = ct.entry
    WHERE ct.entry BETWEEN 70001 AND 71000 AND cn.entry NOT IN (SELECT Id FROM world.creature);
    

    where 'world' and 'characters' are your DB names (my world DB still called 'trinity' lol).

  10. Kreegoth reporter

    Thank you now just to compare and remove;P

    Also as of this moment there have been no crashes!

  11. Kreegoth reporter

    One more question Im sure this is related to the same issue as above a bot that I have successfully spawned in the world will sometimes now give the error Sorry I only serve my master :OWNNAME for instance a bot named Veroth will say Sorry I only serve my master:Veroth.

    In the Characters_Npcbot table the bot does not have a listed owner

    I am guessing this is due to the bot previously having an owner before I attempted the new DB.

    I can use a GM to reset the owner im sure but for future reference is there a SQL to reset All bots owners?

    Any suggestions?

  12. Kreegoth reporter

    Having looked into it further it appears that the bot is indeed owned by an actual player. I have tested it with numerous bots and player combination.

    The bots always reply with their own name now as owner.

    Was that intended?

  13. trickerer repo owner

    There is no possibility for bots to answer with their own name as owner because the piece of code which determines the name is looking for player name (trying to find player in world, querying characters DB), if player is not found it will be "unknown". Still, if player owner has the same name as bot does, then it is possible but still visual only. There is also can be a situation which I didn't test: if player was deleted in unusual way (directly from DB).

    To reset all bots' owners do:

    UPDATE `characters_npcbot` SET owner = '0';
    

    then restart server.

    And no, it cannot be related to your new DB (unless you imported/truncated characters table).

  14. Kreegoth reporter

    What I did was I used completely new world db and existing char db. I dunno I'll see what I can figure out.

  15. Roberto Olivares

    Eu estou tendo o mesmo problema com os bot em meu server

    /home/user/trinitycore335/src/server/game/AI/NpcBots/bot_ai.cpp:6327 in InitFaction ASSERTION FAILED: result ./worldT3(ZN13bot_minion_ai11InitFactionEv+0x26a) [0x8b5e56a] ./worldT3(_ZN6bot_ai11DefaultInitEv+0x9c) [0x8b7178c] ./worldT3(_ZN8Creature14AIM_InitializeEP10CreatureAI+0x133) [0x86a8013] ./worldT3(_ZN8Creature10AddToWorldEv+0x117) [0x86b6e17] ./worldT3(_Z15AddObjectHelperI8CreatureEvR9CoordPairILj512EER14GridRefManagerIT_ERjP3MapPS5+0xba) [0x8c6de5a] ./worldT3(_ZN16ObjectGridLoader5VisitER14GridRefManagerI8CreatureE+0x1d9) [0x8c6e6a9] ./worldT3(_ZN16ObjectGridLoader5LoadNEv+0xa1) [0x8c6e851] ./worldT3(_ZN3Map16EnsureGridLoadedERK4Cell+0x1da) [0x898008a] ./worldT3(_ZN3Map8LoadGridEff+0xc7) [0x89827f7] ./worldT3(_ZN10MapManager10InitializeEv+0x8af) [0x896773f] ./worldT3(_ZN5World23SetInitialWorldSettingsEv+0x4e7d) [0x8ae923d] ./worldT3(_ZN6Master3RunEv+0xf7a) [0x85bd5da] ./worldT3(main+0x292) [0x8530932] /lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0xb6d8ea83] ./worldT3() [0x85a46cf]

    Falha de segmentação (imagem do núcleo gravada)

  16. trickerer repo owner

    @Kreegoth

    Having looked into it further it appears that the bot is indeed owned by an actual player. I have tested it with numerous bots and player combination.
    
    The bots always reply with their own name now as owner.
    
    Was that intended?
    

    Found the reason for that. Gonna fix with next update.

  17. Roberto Olivares

    Friend of the English translator not know if it helps but it seems to me that this occurs because the player quit the game and bot remain logged. And it would be interesting to include in the new update that qdo the player creates a bot to be abandoned or not it tames it to be deleted.

    Because it also seems to cause the crash

    bot_ai::SetBotOwner(): bot Turak (id: 70047) has master Exterminador while trying to set to Exterminador... Falha de segmentação (imagem do núcleo gravada) user@us-nc-dct1-s10k:~/buildT3/bin$

  18. trickerer repo owner

    @Olivares sorry, I don't understand Portuguese, but still I understand what crash you mentioned. Encountered it yesterday myself. Can say that it's not related to dismissing bot (for me it happen on first login after server start). Tried to figure out temp fix, we'll see if it helps

  19. Icey

    i still get this even on new db, if i remove bot from characters_npcbot it will boot up fine

    by the way with this error, if u have put bots in server they run fine, only get this error after i have added bots and restarted server.

    /home/battlestation/TrinityCore/src/server/game/AI/NpcBots/bot_ai.cpp:6462 in In itFaction ASSERTION FAILED: result ./worldserver(ZN6bot_ai11DefaultInitEv+0x8f) [0xf0809f] ./worldserver(_ZN8Creature14AIM_InitializeEP10CreatureAI+0x136) [0xb01626] ./worldserver(_ZN8Creature10AddToWorldEv+0xe7) [0xb0e917] ./worldserver(_Z15AddObjectHelperI8CreatureEvR9CoordPairILj512EER14GridRefManage rIT_ERjP3MapPS5+0xbb) [0x1010d5b] ./worldserver(_ZN16ObjectGridLoader5VisitER14GridRefManagerI8CreatureE+0x1ef) [0 x101112f] ./worldserver(_ZN16ObjectGridLoader5LoadNEv+0xaa) [0x101176a] ./worldserver(_ZN3Map16EnsureGridLoadedERK4Cell+0x1eb) [0xd900ab] ./worldserver(_ZN3Map8LoadGridEff+0xb0) [0xd92750] ./worldserver(_ZN10MapManager10InitializeEv+0x8b7) [0xd82347] ./worldserver(_ZN5World23SetInitialWorldSettingsEv+0x46f9) [0xec58c9] ./worldserver(_ZN6Master3RunEv+0xf47) [0x9df667] ./worldserver(main+0x23e) [0x96226e] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed) [0x7fadb885f76d] ./worldserver() [0x9c6f7d]

  20. Serg Esserg

    http://paste.ubuntu.com/7695247/

    Crash appear in vc dungeon. I'm 80 level. I run for clear dungeon and agro many mobs. My bot agro some mobs from me, and than I kicked him from party.(right click on icon party. Not with mob dialog) . Appeared message that bot will be remove from instance. After 60 sec. Server crashed. Notes: bot was in combat.

  21. Icey

    by the way with this error, if u have put bots in server they run fine, only get this error after i have added bots and restarted server.

  22. Serg Esserg

    Yes, this also. I think that after using bots and restart server can't load owners for bot. After reapload clean sql in char base server has run.

  23. Maxxgold

    From Trickerer: About commands: you are not supposed to add/delete npcbots using .npc commands and you are not supposed to add/delete entries from 'charaters_npcbot' or 'creature' tables

    I think that some of these problems are being caused by people using the npc add command instead of using npcbot spawn command. Also if you are deleting entries in your database you are just asking for problems.

    I am having no problems with the latest version of Trickerer's NewNpcBots. I am using the updated version by Lordpsyan though.

  24. trickerer repo owner

    @Maxxgold I agree, there are crashes caused by mistakes in using bot system, but still there are at least two crashes which must be dealt with.

    1) by @sesserg (has to be simple to fix)
    2) crash at server loading (InitFaction() assertion fail), which is much more complicated. Got such crash myself. Considering this crash is rare I assume it is related to threads and the only thing I can do is to recompose DB calls used, maybe even with pre-selecting whole table. I'll deal with it somehow

  25. Maxxgold

    Just an FYI but the updated version by Lordpsyan is working fine with no crashes but it was like 47 errors when you compile it.

  26. Log in to comment