NC crashes with RTG
redgoblin88 opened this issue ยท 7 comments
on my server we were crashing several times but i manged to narrow down the crash to just "Natures compass" and "Realistic Terrain Generation" (or more simply RTG)
The server that we are running is enigmatica 2 expert on version 1.72
how to replicate:
it turns out to be quite hard, depending on your seed and nearby biomes.
but to put it simply, createa new RTG world and use the compass to try and find any biome. upon "searching" for a biome that is nowhere near you and is far away, the compass will start to constantly search and search, taking up 100% of the instances/servers resources and eventually crashing
mods and versions:
Natures compass: 1.6.0
RTG: 6.1.0.0
Forge: 14.23.5.2847
if you wish to test this in the pack which the server is on:
Enigmatica 2 expert: 1.72 (with 6.1.0.0 RTG added, nothing more, nothing less)
unfortunatelly in single player, no crashlog is generated but on my server a crashlog was generated (though not exactly helpful)
single player logs: https://pastebin.com/hhN0Sabj
server crashlog: https://pastebin.com/8HpuWEAK
To me, this sounds like a performance configuration issue. Searching for a biome can be a very intensive process, so you should tweak the config to avoid timeouts. You can do this by lowering lowering naturescompass.distanceModifier
, lowering naturescompass.maxSamples
, and raising naturescompass.sampleSpaceModifier
. There's more info in the config. Keep in mind that these changes will make searches less accurate (i.e. searching less area), but a proper configuration can prevent these timeouts.
Let me know if this works.
As I stated in the RTG discord when this issue was brought to my attention, this issue has to do with the use of reflection in GuiTransparentTextField#drawTextField using MCP names which will only work in a dev (deobfuscated) environment. When the mod is loaded outside of a dev environment all of those fields will have the SRG names.
The resulting stacktrace from the NoSuchFieldException
is then spammed to both log files repeatedly for every single operation which will quickly lead to resource issues and will eventually cause the game to crash.
This is a perfect example for the use of an access transformer, which is how I recommend this be fixed. If you do not want to add an access transformer to lower the access restrictions on those fields, then you should use net.minecraftforge.fml.common.ObfuscationReflectionHelper
to reflectively access the required fields using the SRG names. (ObfuscationReflectionHelper will change the access anyways, so there isn't really a reason to just not use an access transformer.)
ok i have
reduced max samples down from 1,000,000 to 10,000
sample space modifier up from 16 to 64
max search distance is at default 2,500 which is just walking distance for me so is left alone
still crashes
but with a different log, but still suggesting overload https://pastebin.com/dcPGFpDu
[edit] before you say "oh you must only have 125MB of RAM allocated", i have 8GB allocated
This issue should be fixed as of version 1.6.1 (out now), but please try it out and confirm.
@srs-bsns Thanks so much for the info. Someone in a different issue reported the NoSuchFieldException
stacktrace and I figured it was due to obfuscation, but I had no idea these two issues were related. Currently working on a fix as per your recommendations.
Also getting this crash on my server. I use Biome Bundle which uses RTG. Thanks!
Server has 6GB RAM on a moderately light pack (we ask the clients to run on 4GB).