Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak on linux #15

Closed
KyGost opened this issue Sep 4, 2021 · 27 comments
Closed

Memory leak on linux #15

KyGost opened this issue Sep 4, 2021 · 27 comments
Labels

Comments

@KyGost
Copy link
Contributor

KyGost commented Sep 4, 2021

Launching minecraft with MCMTFabric currently seems to leave memory to bubble up pretty quickly. I got to 14GB used in less than 5 minutes. While typing this, another 3 minutes has gone by and it's at 17GB.
(also affects performance very noticably as one might reasonably expect)
I've experienced something that feels very similar to this, with EssentialsCommands.

Link to trying to debug and solution with the developer of that:
https://discord.com/channels/513219024927326211/857077956336943154/871488694530494535

I use a somewhat hacky library to fix the Nickname command issue with command parsing. It uses stuff like JNT (Java Native Tools).

Aha! I've managed to reproduce this issue on Linux. Can confirm that it 100% has something to do with the lib I mentioned. Will see what I can do about this.

https://discord.com/channels/513219024927326211/857077956336943154/871873153490624512

@himekifee
Copy link
Owner

I didn't use that so I'm not sure what's going on, are you able to use visualvm to dump a snapshot?

@KyGost
Copy link
Contributor Author

KyGost commented Sep 4, 2021

Can & will do, probably tomorrow.

@KyGost
Copy link
Contributor Author

KyGost commented Sep 4, 2021

Here you go.
Performed on client (single player) with a few other mods. Let me know if you need me to change either of these things.
Note that I noticed in the latter half that entities weren't responding and when trying to save and quit the game froze at "Saving World".
application-1630769251991.apps
latest.log

@himekifee
Copy link
Owner

I saw there is some sort of leak in Render thread, which is not what fabric will interference with. Would you like to try remove starlight so I can make sure it is some bug when both mods installed?

@KyGost
Copy link
Contributor Author

KyGost commented Sep 4, 2021

Performed again without any other mods:
application-1630769975988.apps
latest.log

@KyGost
Copy link
Contributor Author

KyGost commented Sep 4, 2021

(still occured. Didn't have issues with entities and saving though. Not sure if that was due to some other mod or chance)

@himekifee
Copy link
Owner

Where did you see it's using so much memory? htop?

@KyGost
Copy link
Contributor Author

KyGost commented Sep 4, 2021

System monitor

@himekifee
Copy link
Owner

Can you show the memory details by right-clicking the process and select memory details?

@himekifee
Copy link
Owner

It didn't happen to me. Have you tried another map?

@himekifee himekifee reopened this Sep 4, 2021
@himekifee
Copy link
Owner

Misclick

@KyGost
Copy link
Contributor Author

KyGost commented Sep 5, 2021

Same setup as the previous one.
I've added a memory sampling too, I hope that was included in the snapshot.

application-1630810242890.apps

Some screenshots in reverse-chronological order:
mem7
mem_det2
mem_det1
mem6
mem5
mem4
mem3
mem2
mem1

@KyGost
Copy link
Contributor Author

KyGost commented Sep 5, 2021

It didn't happen to me. Have you tried another map?

It happened when I first tried MCMT on a headless server with an existing map.
I'll try with another new map but won't worry about profiling.

@KyGost
Copy link
Contributor Author

KyGost commented Sep 5, 2021

Issue persists on a new map. I ended up profiling anyway:

snapshot-1630810791028.nps

I also got a heapdump and memory sample but they are much bigger files so let me know if you want them and I can send them.

@himekifee
Copy link
Owner

Yup, please send that somewhere.

@KyGost
Copy link
Contributor Author

KyGost commented Sep 5, 2021

@himekifee
Copy link
Owner

I didn't see any abnormal usage of mem, but from your screenshot, those mems were dirty memory. This means it may be related to your system setting or java implementation. Would you like to try Graal VM?

@KyGost
Copy link
Contributor Author

KyGost commented Sep 5, 2021

This only occurs with this mod thus if it is my system it is an issue with this interaction between my system and this mod.

Having said that I'll give Graal a go and see if there's any change.

Though I suspect, even if Graal fixes it, there's a memory problem in or under the mod. Even if the issue is showing up due to my system failing to release unused memory, it appears to me as though the cause is something using far too much memory for too quickly and relying on GC to clean it up (evident by simply the graph which shows the memory swiftly increasing and GC needing to regularly come through to clean up).
When you profile the memory usage on your machine do you see this behaviour?

@himekifee
Copy link
Owner

Dirty memory is about cache write to disk. I don't remember MCMTFabric has anything with disk write now but one possible issue is cloth config. Can you post the mcmtfabric.toml file in your .minecraft/config?

@KyGost
Copy link
Contributor Author

KyGost commented Sep 5, 2021

Though I suspect, even if Graal fixes it, there's a memory problem in or under the mod. Even if the issue is showing up due to my system failing to release unused memory, it appears to me as though the cause is something using far too much memory for too quickly and relying on GC to clean it up (evident by simply the graph which shows the memory swiftly increasing and GC needing to regularly come through to clean up).

I take this back. Memory usage patterns aren't all that different with this mod gone (just tested); my apologies.
(Though it doesn't have dirty memory issues)

@KyGost
Copy link
Contributor Author

KyGost commented Sep 5, 2021

Here's my config:

disabled = false
paraMax = -1
paraMaxMode = "Standard"
disableWorld = false
disableWorldPostTick = false
disableEntity = false
disableTileEntity = false
chunkLockModded = true
teWhiteListString = []
teBlackListString = []
teUnfoundWhiteList = []
teUnfoundBlackList = []
disableEnvironment = false
disableChunkProvider = false
enableChunkTimeout = false
enableTimeoutRegen = false
timeoutCount = 5000
opsTracing = false
logCap = 720000

@himekifee
Copy link
Owner

Good to hear that. Can I close the issue then?

@KyGost
Copy link
Contributor Author

KyGost commented Sep 5, 2021

I mean to say that memory usage patterns are similar without MCMT:
mem_vanilla

But that isn't to say that there is memory bubbling.
Without MCMT I do not get issues with memory inflating. With it I do.

Will be testing Graal now.

@KyGost
Copy link
Contributor Author

KyGost commented Sep 5, 2021

Took me a bit to get Graal installed, testing using latest Java 16 version now (graalvm-ce-java16-21.2.0).

@KyGost
Copy link
Contributor Author

KyGost commented Sep 5, 2021

Looks like it has woked!
I'm really glad for my own sake but generally I'd think it inideal to need to change java version to use MCMT. Any ideas why this might happen for MCMT but not Vanilla or other mods?

Won't close as this is still an issue for others.

graal-test.apps

@github-actions
Copy link

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Jul 21, 2022
@github-actions
Copy link

github-actions bot commented Aug 5, 2022

This issue was closed because it has been inactive for 14 days since being marked as stale.

@github-actions github-actions bot closed this as completed Aug 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants