[1.14.4] Severe memory leak when looking at villagers
Gamertech opened this issue · 13 comments
Minecolonies version
minecolonies-0.10.715-RELEASE-universal.jar
Version: 1.14.4
Forge: 28.2.3
Pack: Enigmatica 4 - 0.4.10
Expected behavior
Continued smooth operation of the modpack
Actual behaviour
Minecolonies creates a huge memory leak, consuming approx 5-20MB/s in the Java binary shown in resource manager (not reflected in F3 mem usage).
Working on tracking it down, but I believe it came from using the building tool to try and place a citizen hut without the hut item in my inventory. (PS it places a build order without a plot or any warning that you need the hut block to place).
Rolling back to a backup before placement shows no memory leak.
Steps to reproduce the problem
- Obtain the Structurize building tool
- Use the building tool to place a citizen hut plot without the citizen hut block in inventory
- The tool places a 3x3 square of construction tape
- Profit from all the spare RAM you don't have :)
Logs: Latest.log and crashlog at https://gist.github.com/
- latest.log: https://gist.github.com/Gamertech/c762fb290f3548a7f5833c72ff52a7cd
- crashlog: N/A
We don't support 1.14 anymore, but if you can find the root cause I think we will fix it.
Btw from the log there is a bunch of things going wrong around json reader for recipes, also not sure what kind of weird job is org.openzen.zenscript from craft tweaker doing around java collections
Yea, there's a fair few other errors in there, but don't seem to be hurting much atm.
After reloading the world, the RAM usage stayed pretty steady until I looked at the Minecolonies site.
If I'm looking away, business as usual. If I look at the site, instant memory leak. Usage just keeps climbing and doesn't free up if I look away, just immediately stops climbing.
Breaking the builder and town hall blocks as well as all other Minecolonies blocks such as racks had no effect, however killing all villagers however stopped it cold.
With zero Minecolonies villagers in view, the memory leak completely stops. However the consumed mem still doesn't free up.
Reloading to free up the mem and looking at the colony without villagers confirms no more memory leak.
So definitely something to do with the villagers. AI?
Yea, I started a fresh creative world with nothing in it. Placed the town hall block, the instant the 1st villager spawned and I looked at them, the memory usage started climbing. The more villagers, the faster it ate.
New day, new testing.
I've created a fresh 1.14.4 profile with only Minecolonies/Structurize installed and the identical memory leak still occurs. So not a mod conflict from the pack.
I did the same with 1.15.2, but it worked as intended. Villagers spawned without a memory leak, so it's isolated to 1.14.
No, it's a long standing bug with Mojang's launcher that will be "fixed in the next release", but Twitch has never been snappy with that.
I created a fresh, identical instance in MultiMC where debug does work and got this:
https://gist.github.com/Gamertech/4d07c820a2fffd373d3d414aff6fcefb
Doesn't show anything at all different though. Still the same "invalid resource name" errors from Minecolonies during loading, but nothing during the leak though.
The Mojang launcher hasn't generated a debug log for months. They still haven't gotten around to fixing that, either that or Twitch hasn't updated the launcher.
Latest however: https://gist.github.com/Gamertech/b63ce7daf0ea6ccacc0404bf030f87f0
There's a few Minecolonies errors in the log, absolutely nothing once the leak starts however.
Just:
[20:05:04] [Client thread/INFO]: [CHAT] §6 The first settler arrived at your colony. You should place a builder's hut to start your settlement.
Then 20 seconds later it's already gained 3GB and still climbing. Esc pausing the game and tabbing out while still looking at the villager does nothing, it just keeps climbing. Only stopping by looking away.
By [20:05:54] the Java instance was already nearly 9GB and still climbing. In-game F3 still showed 2.5GB used.
weridly enough ive been getting constant leaks from minecolonies and im on the 1.12.2 verision and it dose not matter if i look at them or not. probly not as bad as what gamertech is getting but in the debug im seeing around 300-500+ leaks and massive tick lag after it