-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Excessive RAM usage with Animalia (memory leak ?) #94
Comments
Can you determine whether this high memory usage happens in the engine or in Lua? I would like to know what |
Hello and thanks for your interest, How I am supposed to use this string ? Where should I put it ? In the minetestserver console ? In the in-game console ? After a quick research, it seems to be a LUA function, maybe then I should add it into some .lua file ? If that's the case, which one ? Regards, |
Yes, this is a Lua function. Its return value tells you how much memory Lua is currently using. You could put this in a mod which logs it periodically, say, once a minute. So something like local function log_memory_usage()
minetest.log("info", "Lua memory usage: " .. collectgarbage("count") .. " Kb")
minetest.after(60 --[[once a minute]], log_memory_usage)
end
minetest.register_on_mods_loaded(log_memory_usage) this can be put in a fresh mod, say |
I tried to add a directory inside /home/minetestserver/.minetest/mods/logmem, inside I added to init.lua your code, and then modified it for 20 seconds (I'm not patient), it was also added to world.mt the line «load_mod_logmen = true». But no luck, I can' find anything: «tail -f Minetest/logs/testAvecJustine.log | grep "Lua memory usage:"» Just output nothing (this file is the log of the server), as using grep myself, but I see this in the log: «2024-05-16 22:30:17: WARNING[Main]: Mod logmem at /home/minetestadmin/.minetest/mods/logmem: Which I guess is not that important. Simply saying «it's not a good thing», but it should works, right ? Did I missed something in your steps ? Regards, |
Yes, it should work. I assume your |
Changed the line in the init.lua inside the logmem directory, it was the level indeed, thanks. So, after some hours on a fresh game, it happened again. First output is my own bash to retrieve the actual memory usage of the minetestserver process:
Then, the output of the server at the same time (minus 1 minute) until I shut it down violently before it crash anything:
You'll see a lot of warning about wildlife:deer not defined, because I disabled it. In my opinion it's probably nothing because it happened the same way, on our last game, with that mod enabled. I might be delusional and not skilled to be factual about that tho. If needed, please ask. Good luck. Regards, |
It looks like Lua memory usage is not the culprit. This means it's probably an engine issue that is merely brought to light by Animalia; or Animalia is somehow forcing the engine to use absurd amounts of memory. If this really is an engine memory leak where memory is not freed at all, you should be able to detect it by compiling with a leak sanitizer: When Minetest shuts down, this should then report any memory leaks (note that there are some smaller leaks, but we're after a big leak here). Compiling with a leak sanitizer can be achieved by passing |
Hello, I managed to compile minetest with the CXX_FLAGS you asked for, at least it seems like. No options (aka USE FLAG in Gentoo) was changed, the only change should be the addition of that CXX_FLAGS. Here a quick test to see if it has enabled it, I'm not the best for these matters but it looks like it was enabled.
So, from here, how it'll help us see if there is a problem on memory leaking from the engine ? Does this will print information into the server console, or into some file somewhere ? Maybe it is used only for the building and should be able to see the build.log for this ? Regards, |
I've got the same problem with https://github.com/ElCeejo/draconis @ElCeejo is probably lost in real life? Maybe more https://www.patreon.com/ElCeejo would help? |
Yes. This checks whether Minetest is leaking memory by allocating it and never freeing it, not even at program shutdown. This will not catch all leaks (for example, there might be a "run-time" leak, where the memory is still freed when Minetest is exited), but it catches many leaks. The output should be in the server console after Minetest has shut down. Another thing you could try would be to |
Hello,
I detected what could be a memory leak in this mod. But I'm not a dev and prefer to stay factual:
Running 5.8.0 minetestserver, with other mods, I had a big problem with ram usage.
Animalia makes the server use more than 40Gb, while I have 16Gb of RAM and 16Gb of SWAP.
Minetest & minetestserver were compiled from Gentoo ebuild repository : https://packages.gentoo.org/packages/games-engines/minetest
I know it does not come from my client, but minetestserver because even if I play on the same workstation that is running the server, so it's on the same machine minetestserver (runned from command line) + client, if another players joins but I don't, the problem is the same.
The server started to act weird, slow, and it was a very huge amount of RAM usage from minetestserver. After disabling mod one after each other, it does not happens without Animalia, and don't act again with all other mods enabled (without Animalia).
It started with a sudden heavy RAM usage after ~1h of playing with Animalia, then, every time the server was restarted and exactly when a new player join (me or another), the amount of RAM explode: In less than 10 seconds it used already almost my 16Gb and was starting to write quickly into swap, slowing the whole system.
Also, if the server is empty, I was able to run it for 8 hours straight without a single problem, but once someone join, it use this huge amount of RAM in seconds.
To shows how fast and critical this is, below some extract of a simple bash script taking the amount of ram used by minetestserver every 5 seconds. It start to act very quicky:
Server is running, empty:
15-05-2024 19:28:17
Then, a player come:
15-05-2024 19:28:22
--- * --- * --- * ---
--- * --- * --- * ---
15-05-2024 19:28:27
--- * --- * --- * ---
--- * --- * --- * ---
15-05-2024 19:28:32
--- * --- * --- * ---
--- * --- * --- * ---
15-05-2024 19:28:37
--- * --- * --- * ---
--- * --- * --- * ---
15-05-2024 19:28:42
--- * --- * --- * ---
--- * --- * --- * ---
15-05-2024 19:28:47
--- * --- * --- * ---
--- * --- * --- * ---
15-05-2024 19:28:52
--- * --- * --- * ---
--- * --- * --- * ---
15-05-2024 19:28:57
As you can see, it's increasing very quickly, but sometimes it goes down a bit (from 21Gb to 14, then 43…).
I have to Gatling the Ctrl^C keys to turn it off, otherwise it can hangs for a while until the system finally drop the SWAP and RAM usage. Sometimes I had to kill the minetestserver process with kill -9, otherwise it was non-effective.
I'm not use to do bug report, so please if you need more files, informations or test, ask me, will be glad to help.
Regards,
GASPARD DE RENEFORT Kévin
The text was updated successfully, but these errors were encountered: