trickerer / Trinity-Bots

NPCBots for TrinityCore and AzerothCore 3.3.5
https://github.com/trickerer/TrinityCore-3.3.5-with-NPCBots/
446 stars 148 forks source link

[AC] [Crash] [Core] Creature GUID overflow, shutting down server #798

Closed silviu20092 closed 1 month ago

silviu20092 commented 1 month ago

DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

Current behaviour

Spawning a lot of wandering bots (I currently spawned 10000) and keeping the server online for several days (5 to 10 days) will always result in this issue: Creature guid overflow!! Can't continue, shutting down server. I don't have a crashlog but the issue should be self-explanatory. I am not entirely sure why creature GUID keeps going up and eventually overflowing. I assume this issue can technically happen even with a low amount of wandering bots, although it would probably take a lot more time.

Expected behaviour

Should not crash?

Crashlog

No response

Steps to reproduce the problem

  1. Spawn 10000 wandering bots
  2. Wait several days
  3. Server crashes with creature guid overflow

TrinityCore or AzerothCore

AzerothCore

Core rev. hash/commit

AzerothCore rev. ab7405f94e89+ 2024-04-30 06:56:17 -0300 (master branch) (Unix, RelWithDebInfo, Static) (worldserver-daemon)

Operating system

Ubuntu 22.04

Russianranger commented 1 month ago

You're using my unofficial addition to increase wandering bots, however this is not officially supported. Personally I do not have the skills to assess why the overflow is occurring, only how to increase the number of bots. This may be related to pets, but I'm not sure. However since this isn't part of the official npcbots project, support is limited.

silviu20092 commented 1 month ago

What do you mean by "your unofficial addition"? I simply created a Java application that generates an .sql file which inserts however many bots I want. There is even an official npcbot command that creates bots for you, but it's too slow and tedious to create a lot. Regarding the overflow, maybe it's pets, but damn why would it create over 2 billion pets? Seems weird. I also attached a sample .sql that I generated. bots_custom.sql.zip

trickerer commented 1 month ago

Well for starters you can't spawn 10000 wandering bots normally. Secondly: even unmodded core isn't really supposed to run for more than a day. But if you need an explanation of the technical side of the matter I guess I can provide you some.

Yes, bots do spawn a lot of stuff. Totems, pets, on-kill summons - each of them generates a guid when created. Creature guid overflow occurs when the counter reaches 2^24 - 1 = 16,777,215. Let's assume your creature table has MAX(guid) about the 767,215 remainder of that (default AC table isn't compact at all in this regard). For guid overflow to occur within 10 days with 10,000 bots active server needs to generate 16,000,000 guids. 10 days is 240 * 60 = 14,400 minutes. 16 * 10^6 / 14,400 = 1,111 - more than one thousand guids per minute or 0.111 summons per bot per minute or about 1 summon every 9 minutes per bot (4.5 minutes for 5 days). More than a half of bot classes are heavy summoners so 1 summon per summoner bot per 4.5 minutes is enough (2.25 minutes for 5 days).

Now this calculus doesn't count players and creatures in the world, but considering there is going to be much more bots in world than above categories I'd say with 10k wandering bots guid overflow within 5 days is quite possible.

Russianranger commented 1 month ago

My bad - I created an SQL file about 10 months ago that contained 11,500 bots that I shared with the repack community at large, so I just assumed it was that.

If I recall the last time this occurred, when wandering bots were still new, this pertained to the treants that Druids could summon. The number you mentioned still seems high, but assuming 500 Druids running around, maybe 50 of which are leveled enough to summon treants (3 at a time - 5 minute intervals on average) - that's 150 treants every 5 minutes. Doing some math - that's 216k treants every 5 days, or 432k every 10 days. The way I came to those numbers is 7200 minutes for 5 days, divided by 5 (for number of 5 minute intervals) which comes out to 1440, then that number times 150 (treants).

And we're also just assuming it's treants and nothing else, like army of the dead ghouls.

All that to say, I believe trickerer created a larger array from last time, but not sure if he can expand it further without causing other issues. Only recommendation I would have is to reset the server at the 4 day marker.

silviu20092 commented 1 month ago

Alright, so basically the crash is intended, 10000 is too much. I suspected as much, especially now that you mention the overflow happening at 2^24 and not 2^32 as I was expecting. Thanks all for the replies.