Lua OOM errors

User avatar
Wuzzy
Member
 
Posts: 2770
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Lua OOM errors

by Wuzzy » Wed Nov 15, 2017 04:43

Some people keep reporting OOM errors for my subgame “MineClone 2”.

Here's one of the posted errors:
2017-11-14 21:07:37: ERROR[Main]: ServerError: AsyncErr: Lua: finishGenOOM error from mod 'mcl_dungeons' in callback environment_OnGenerated(): not enough memory
2017-11-14 21:07:37: ERROR[Main]: Current Lua memory usage: 14 MB


AFAIK “OOM” means “Out Of Memory” and this might not be my fault. My question is, is there anything that I, as subgame maker, can use to prevent this anyway? Or does the user have to set a certain setting?
Or did I just screw up? What are possible stupid ways to code a mod so horribly bad that it can trigger an OOM error for everyone? :D

But 14 MB Lua memory limit doesn't seem much, I'm surprised.
I'm creating MineClone 2, a Minecraft clone for Minetest. I made the Help modpack, adding in-game help to Minetest.
 

User avatar
GreenDimond
Member
 
Posts: 961
Joined: Wed Oct 28, 2015 01:26
Location: Just outside of existence.
GitHub: GreenXenith
IRC: GreenDimond
In-game: GreenDimond

Re: Lua OOM errors

by GreenDimond » Wed Nov 15, 2017 05:51

Wuzzy wrote:What are possible stupid ways to code a mod so horribly bad that it can trigger an OOM error for everyone? :D

While I have no idea what your problem might really be, I suspect any sort of intensive code loop could bog down memory and cause such an error.
My YouTube channel. I moderate the HOMETOWN Server. My Mods: Tac Nayn - Sandplus - Waffles - Pumpkin Spice ✂️- - - - - -
 

User avatar
v-rob
Member
 
Posts: 324
Joined: Thu Mar 24, 2016 03:19

Re: Lua OOM errors

by v-rob » Wed Nov 15, 2017 15:41

I often got this in 0.4.14 and below with no mods enabled at all by just exploring the world. I explored too much, I got this error, which repeated commonly until I close down Minetest and restarted it.

I also get it from enabling way too many mods, nearly all of which added only static nodes.
 

User avatar
Krock
Developer
 
Posts: 3737
Joined: Thu Oct 03, 2013 07:48
Location: Switzerland
GitHub: SmallJoker

Re: Lua OOM errors

by Krock » Wed Nov 15, 2017 18:55

Most likely caused by LuaJIT in combination with map generating mods.
These errors are usually caused by VManip data or noise tables and may reach a few gigabytes of RAM in a short time. I guess the unexpected low reported memory use in the logs were caused by the garbage collector, which cleaned up the unused data right before the original RAM use was measured.
Please see this comment and the following ones to get possible solutions for this problem if reducing the memory use in the mods isn't possible.
Mod Search Engine - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>
 

User avatar
duane
Member
 
Posts: 1200
Joined: Wed Aug 19, 2015 19:11
Location: Oklahoma City
GitHub: duane-r

Re: Lua OOM errors

by duane » Thu Nov 16, 2017 02:10

You might want to ask your posters what system and software they're using. That's a suspiciously low number for memory. If they're running a server on an old cellphone, you're probably not going to get anywhere.

Another thing you could do is put all of your on_generated calls into one function, assuming you have more than one. Not duplicating the map data saves a lot of memory thrashing. If you're worried about using each mod separately, just check for the presence of one and use its on_generated loop, breaking out the independent parts of each mod's callback as a separate function the main loop can call. I did that with booty and squaresville (the lua version). It saves a lot of time too, as moving map data sucks up a lot of cpu time.
Believe in people and you don't need to believe anything else.
 

User avatar
maikerumine
Member
 
Posts: 1267
Joined: Mon Aug 04, 2014 14:27
GitHub: maikerumine
In-game: maikerumine

Re: Lua OOM errors

by maikerumine » Fri Nov 17, 2017 02:49

Best fix:
Run a server and connect local. This solves most oom errors for me.
 

User avatar
rubenwardy
Moderator
 
Posts: 4813
Joined: Tue Jun 12, 2012 18:11
Location: United Kingdom
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: Lua OOM errors

by rubenwardy » Fri Nov 17, 2017 13:28

duane wrote:You might want to ask your posters what system and software they're using. That's a suspiciously low number for memory. If they're running a server on an old cellphone, you're probably not going to get anywhere.


LuaJIT is out of memory, not their system
 

paramat
Developer
 
Posts: 2976
Joined: Sun Oct 28, 2012 00:05
Location: UK
GitHub: paramat
IRC: paramat

Re: Lua OOM errors

by paramat » Sat Nov 18, 2017 02:05

What Krock wrote, don't use LuaJIT and/or apply the memory use optimisations.
 


Return to Modding Discussion



Who is online

Users browsing this forum: No registered users and 4 guests