liyunfan1223 / mod-playerbots

AzerothCore Playerbots Module
https://discord.gg/NQm5QShwf9
GNU Affero General Public License v3.0
286 stars 156 forks source link

Memory Leak #692

Closed davvvve1 closed 1 week ago

davvvve1 commented 1 week ago

Describe the bug When the server has been up for minutes i noticed the Ram usage go up .

Commit hash Latest

To Reproduce Steps to reproduce the behavior: Just keep server up for hours Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context mods dungeonrespawn mod_ahbotmod mod_learnspells mod_assistant mod_no_hearthstone_cooldown

noisiver commented 1 week ago

A few minutes isn't going to cause an instant memory leak, assuming there is one. You have to consider that the maps loaded into memory will take up quite a bit.

We also need more information. What settings are you using? How many bots you have set in the config, do you have smartscale enabled, and so on.

davvvve1 commented 1 week ago

smartscale off running with 3000 bots I have an i7 4 core 8 threads and 32 gb ram

zhangbo8418 commented 1 week ago

smartscale off running with 3000 bots I have an i7 4 core 8 threads and 32 gb ram

I think you should read the instructions for AzerothCore. It takes up about 10G when the map is fully loaded. You don't need to look at the memory usage at the beginning, because its default setting is to load only occupied maps, so as your robot runs around, it is normal for more and more maps to be loaded and the memory usage to increase.

davvvve1 commented 1 week ago

smartscale off running with 3000 bots I have an i7 4 core 8 threads and 32 gb ram

I think you should read the instructions for AzerothCore. It takes up about 10G when the map is fully loaded. You don't need to look at the memory usage at the beginning, because its default setting is to load only occupied maps, so as your robot runs around, it is normal for more and more maps to be loaded and the memory usage to increase.

Yes , i know that . But after 3 days i have a 2000 ms when i type .server config . When i reboot the server its like 32 and after 1 hour its like 150 and rising . It would be wonderful to have like 40 bots for raids and when more people a looking for group / raid more popups . Like typing /@who heal you get a list that you could pick and invite , then they spawn on your server . Just a thought

PaoloBenigni commented 1 week ago

This is behavior that is currently under investigation. The memory amount will continue going up due to some caches that are built up. This is not playerbots specific. However, I've been working to try to find this leak, but as you can hopefully appreciate this is a complicated task.

For now I recommend reducing bots and restarting more frequently.

serverwar commented 1 week ago

smartscale off running with 3000 bots I have an i7 4 core 8 threads and 32 gb ram I would like to understand why use 3 thousand bots, I use 80 -100 and have another 100 real players and my server is always smooth without delay and everyone can have fun and the core uses in 20 hours an average of 5 - 6gb ms is between 15/7, now 3 thousand teleporting bg, up etc, this is not even a leak but exaggerated this is my opinion, don't be offended friend.

PaoloBenigni commented 1 week ago

What we also think may be happening is that an action queue is building up when you have so many bots. This could be why response times go down and memory increases without actually memory leaking

hermensbas commented 1 week ago

There are serveral reason why the mem grows, some ny design some possible due config setups. Possibly some real ones. For its what its.

10-12GB when i load all grids initially and keep the bota amount as low as possible. And make sure use the latest version and config. Autoscale can help slowing down threadqueue buildup.

For now closing the topic.

davvvve1 commented 1 week ago

When i got home from work it ate all 32 ram , and my swap file ;)
Btw i have allways had 3 k bots on server and running the server like weeks and it never had more than 76 ms .

PaoloBenigni commented 1 week ago

Can you identify the previous build you were using when you were running for weeks?

davvvve1 commented 1 week ago

Can you identify the previous build you were using when you were running for weeks?

Sorry no . I took a break from wow for a long time . But now i updated everything . And updated the mods . I belived it was one of the mods that broke , but it wasnt . Now im playing with changing some stuff in world server config and hope from the best .

PaoloBenigni commented 1 week ago

Do remember when this was? If you can narrow things down it could help me trace when this started happening. (Or if it just wasnt noticed)

davvvve1 commented 1 week ago

Do remember when this was? If you can narrow things down it could help me trace when this started happening. (Or if it just wasnt noticed)

Now im only guessing , i dont want to you to get on the wrong trail but , i belive it started when i compiled with the no heart cooldown mod or dungen respawn i f***ed something up. When i have more spare time im gonna recompile it with no mods and see if it is the mods . But now i have recompile it buy removing one mod at the time to narrowed it down . Mabye something fu''' up the database?

davvvve1 commented 1 week ago

At the moment i have change DontCacheRandomMovementPaths to use more cpu and see if that change something . I also change all threads to 8 and sync 8 both in world server and playerbots config . Sorry if i spell like a jail bird , English isnt my native language

PaoloBenigni commented 1 week ago

What I mean is

Btw i have allways had 3 k bots on server and running the server like weeks and it never had more than 76 ms .

When was this running for weeks with no issues? Recently? or in the past.

davvvve1 commented 1 week ago

What I mean is

Btw i have allways had 3 k bots on server and running the server like weeks and it never had more than 76 ms .

When was this running for weeks with no issues? Recently? or in the past.

Like a 2 month ago . It was stable and never more that 76 ms . With the same mods .

davvvve1 commented 1 week ago

And when all memory 32 gb is used up and swap file to , it isnt any crash . Just sluggish to play . 17 hours i had it on when i had to reboot it -

PaoloBenigni commented 1 week ago

Unless there is a specific reason to keep so many bots on, I would in the short term recommend reducing it.

hermensbas commented 1 week ago

We are aware of memory growth there are serveral reasons why the mem would grow. But it seems to mem leak as well, or might be. Atm we unable to find any. Hence we closed the topic, since we tested build 3 months back core and mod giving the exact same behaviour. We aint able to reproduce a none mem growth version and basically nobody atm has the skills it seems to locate the possible mem leak.

What we do know is that the simple amount of bots hits bottleneck in the mapUpdater thread of the core as result building up a threadqueue with locates in memory.

davvvve1 commented 1 week ago

I updated my kernel to the Liquorix Kernel and removed mod-ah-bot and used mod-auctionator . Now it realeses ram instead . 7.01 ram with 3 k bots . I have 18 ms atm after 1 hour . I used to have 120 ms ingame ;)

davvvve1 commented 1 week ago

Server keeping 9 gb ram after 2 hours , but when i did sethekk halls dungeon it starting to lag . gonna reboot and see if its stable for 12 hours ish without playing on it.

davvvve1 commented 1 week ago

After i rebooted its started to eat ram . Mabye a bot strategy that eating the ram ? Hope someone will find the issue i having . I know that it isnt the amount of bots .

PaoloBenigni commented 1 week ago

Honestly, at this point the only thing we know helps is to reduce the number of bots.

Everyone who works on this is a volunteer. If you are willing to assist with investigating the issue it would help us try to identify the source.

hermensbas commented 1 week ago

The core loads a grid of map only when there are players, its called lazy loading or JIT. So of u wanna test make sure your worldserver.conf has the following conf

PreloadAllNonInstancedMapGrids = 1

Which enforces all grids to be loaded, otherwise you endup making the wrong assumptions why the memory is growing.

Next to that the core is a singlethreaded application and the mapUpdate thread can only handle so much. The amount of mapUpdates or processing time of an mapUpdateRequesr will result in temporary saving(inbox queue) that request inmemory till its his turn. U can imagine that number can grow by alot with alot of bots and that store(thread queueing) will grow in your memory. As side effect the bots response gonna be out of sync / slow since the requests are handled much later in time.

davvvve1 commented 1 week ago

Thanks for answer . I have no ram issue anymore . After 6 hours it was only 10 gb and not like before it was eating up 32 gb and the swap .

PaoloBenigni commented 1 week ago

Did you change anything?

davvvve1 commented 1 week ago

Did you change anything?

"I updated my kernel to the Liquorix Kernel and removed mod-ah-bot and used mod-auctionator . Now it realeses ram instead . 7.01 ram with 3 k bots . I have 18 ms atm after 1 hour . I used to have 120 ms ingame ;) . " First i played some bgs and it was ok . When i started to do dungeons then it started to missbehave . Now im change PreloadAllNonInstancedMapGrids = 1 and gonna let it run thru the night . Work tommorrow. Im a newbie on this but not on linux . I like to play wow classic so this is fun for me . And if i could help i try .