Wuzzy2 / MineClone2-Bugs

Bug tracker archive for MineClone 2 (no new posts allowed)
MIT License
7 stars 0 forks source link

Lua: OOM error #438

Closed tacotexmex closed 6 years ago

tacotexmex commented 6 years ago

On mapgen v7 (seed "luschclone") with latest to date MCL2 my game crashed at 200,12,-200, giving this error:

2017-11-29 19:46:57: ERROR[Main]: Current Lua memory usage: 110 MB
2017-11-29 19:46:57: ERROR[Server]: In thread 0x70000a2f5000:
2017-11-29 19:46:57: ERROR[Server]: /Users/travis/build/krondor-game/minetest/src/script/cpp_api/s_base.cpp:7e: static int ScriptApiBase::luaPanic(lua_State *): A fatal error occured: LUA PANIC: unprotected error in call to Lua API (not enough memory)
[1]    68505 abort      /Applications/Minetest.app/Contents/MacOS/minetest

My minetest build is https://github.com/krondor-game/minetest/commit/8b1a844e6909057e74486a8fdb781497990d65fd (same as https://github.com/minetest/minetest/commit/8b1a844e6909057e74486a8fdb781497990d65fd) and I'm on a macOS 10.13.1. The computer has 16GB RAM so I'm not convinced that I really ran out of memory. (No idea of the existence any Lua internal memory limit)

I also had OOM crashes when trying to start up a new world with different seeds a few times before getting a working world. That time I got this error:

AsyncErr: Lua: finishGenOOM error from mod 'mcl_dungeons' in callback environment_onGenerated(): not enough memory
Current Lua memory usage: 17 MB
Wuzzy2 commented 6 years ago

Do you use LuaJIT? Try to run Minetest without it.

tacotexmex commented 6 years ago

Yes, "Krondor builds" are compiled with LuaJIT. Need to learn how to compile it without myself. Or possibly, if @neoascetic would be interested in compiling a build without LuaJIT present?

neoascetic commented 6 years ago

You can try brew install minetest -- without-luajit

tacotexmex commented 6 years ago

Interesting, will try (though it will produce a point release build, not a bleeding edge build)

neoascetic commented 6 years ago

You could try brew install --head --without-luajit minetest also

neoascetic commented 6 years ago

Look what I've found https://github.com/blert2112/stop_lj_oom

tacotexmex commented 6 years ago

Very informative, thanks. Are most MT clients compiled with LuaJIT? Regardless, if the problem is LuaJIT specific one may check _VERSION to deduct if this garbage collector loop should be run at all, if it were to be included in MCL2.

tacotexmex commented 6 years ago

Tried playing with the mod, still crashes:


2017-11-30 21:23:39: ACTION[Server]: singleplayer [127.0.0.1] joins game. 
2017-11-30 21:23:39: ACTION[Server]: singleplayer joins game. List of players: singleplayer
2017-11-30 21:23:40: ERROR[Main]: ServerError: AsyncErr: Lua: finishGenOOM error from mod 'mcl_mapgen_core' in callback environment_OnGenerated(): not enough memory
2017-11-30 21:23:40: ERROR[Main]: Current Lua memory usage: 29 MB
tacotexmex commented 6 years ago

Alright, I've now tried a freshl LuaJIT free build as per brew install --HEAD --without-luajit minetest.

It is clear that the client is able to claim more memory. With LuaJIT memory consumption was always under 1 GB, now it's ~3 GB after 30 min of playtime, which is fine.

However, CPU usage also goes through the roof, claiming 100% CPU and absolutely boils the laptop. With LuaJIT builds the fan doesn't even spin up.

Wuzzy2 commented 6 years ago

So, basically the solution is to not using LuaJIT then.

tacotexmex commented 6 years ago

As I now have deployed MCL2 on a Linux VPS (with regular LuaJIT-enabled minetest) I've noticed no OOM issues at all. [thinking face]