Skip to content
This repository has been archived by the owner on Jun 23, 2024. It is now read-only.

Darkage mapgen triggers Lua OOM #8

Open
Fixer-007 opened this issue Jul 27, 2016 · 9 comments
Open

Darkage mapgen triggers Lua OOM #8

Fixer-007 opened this issue Jul 27, 2016 · 9 comments

Comments

@Fixer-007
Copy link

Fixer-007 commented Jul 27, 2016

I have a subgame that I profiled for some troubles, it has darkage mod, lua mem usage at 20-90 mb (print(collectgarbage("count")/1024), it lets me generate blocks for some time and then suddenly stops at "local data = vm:get_data()" step with "Lua: OOM error from mod 'darkage' in callback environment_OnGenerated(): not enough memory". Removing darkage makes server stable, mem use below 40mb at most without oom.

No OOMs on clean game though, I'm still investigating the issue :/

On a side note I noticed pretty damn suspiciously high usage of cpu by this mod even in passive mode:

 instrumentation                                         |    min µs |    max µs |    avg µs | min % | max % | avg %
-------------------------------------------------------- | --------- | --------- | --------- | ----- | ----- | ------
darkage:                                                |         0 |     54099 |        29 |   0.0 |  99.9 |   0.1
  - on_generated[1] ...................................  |     43797 |     54099 |     48948 |  99.6 |  99.9 |  99.7
@davisonio
Copy link
Owner

Hmm not good, must be the mapgen causing this issue when generating darkage blocks in new areas. I'll look into this.

@Fixer-007
Copy link
Author

Please read this, it may help: https://forum.minetest.net/viewtopic.php?f=18&t=16043

@Fixer-007 Fixer-007 changed the title Darkage triggers Lua OOM on win minetest 0.4.14 with luajit Darkage mapgen triggers Lua OOM Feb 9, 2018
@Fixer-007
Copy link
Author

Fixer-007 commented Feb 9, 2018

Actually, why not use official API for generating ores/veines, look here, Paramat says it won't produce OOM, since it is done via engine, not lua:

https://github.com/minetest/minetest/blob/master/doc/lua_api.txt#L4985
https://github.com/minetest/minetest/blob/master/doc/lua_api.txt#L1143

@Fixer-007
Copy link
Author

More news about optimisations here:
https://forum.minetest.net/viewtopic.php?f=18&t=16043#p314553
https://forum.minetest.net/viewtopic.php?f=18&t=16043#p242631
https://forum.minetest.net/viewtopic.php?f=18&t=19836

@davisonio
Copy link
Owner

I don't have much time at the moment to work on this project but I'm able to merge anything that fixes this. The new optimisations in minetest are great and should be taken advantage of :)

@davisonio
Copy link
Owner

I'm keen on preserving darkage blocks in old maps too.

@paramat
Copy link

paramat commented May 20, 2018

I've updated that advice in the forum and am fairly confident it is correct as of 17th March 2018. Those could be applied (not by me).

Even better, replace all that ore generation code with the ore generation API, there are now several types of oregen to choose from. This will increase mapgen speed and reduce Lua lag on a server.
See #12

@kakalak-lumberJack
Copy link
Contributor

davisonio: i'd be willing to tackle converting the mapgen to the ore generation API if you are interested in switching over. Let me know.

@kakalak-lumberJack
Copy link
Contributor

https://github.com/kakalak-lumberJack/darkage I have updated the mapgen.lua to use the register_ores method instead of the original custom mapgen (still available but unused in legacy_mapgen.lua in my fork). This should resolve the OOM errors, but I'd like to test it a bit more before I make the PR.

I've tried to follow the spirit of the original mapgen within the given limitations of the register_ores methods but have taken a couple liberties to also better suit some of the newer biomes, such as Old red sandstone spawning in dessert stone and dessert_sandstone, etc. I'll be testing and tweaking noise_params and such a bit before I post but I would love to have any testing/feedback on my fork to make sure folks are happy with the prevalence, depths and other characteristics of the ores, before I make a PR. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants