Ex Nihilo: Sequentia

Ex Nihilo: Sequentia

9M Downloads

[BUG] Fake players interacting with sieves cause memory leaks (NeoForged 1.20.1)

Daxturus opened this issue ยท 9 comments

commented

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Currently, using either Create mod deployers and/or Click Machines on Ex Nihilo Sequentia sieves causes memory leaks -- climbing memory usage ultimately leading to a java.lang.OutOfMemory error and/or the game hanging.
Memory_Leak_with_Click_Machines
Memory_Leak_with_Create_Deployers

Expected Behavior

Ideally, using a Create deployer or Click Machine on a sieve would not cause a memory leak or crash; these devices should work and should be able to operate sieves indefinitely without the server closing.
Click_Machine_Setup
Create_Deployer_Setup

Steps to Reproduce

  1. Enable mesh durability in Ex Nihilo settings. (This is what I have used in my testing. I am unsure if the problem occurs without this.)
  2. Install either the Create Mod or the Click Machine mod. Place Create deployers or click machines facing a sieve; stock one with meshes and another with sifting material (In my testing, I used gravel and flint meshes).
  3. Make sure to handle the items produced in testing; using an enclosed block of lava over the sieve seems to work for disposing of the items so they do not interfere with the test.
  4. Activate the deployers or click machines by powering them; once they begin to use the sieve, memory usage begins to increase. It may be unnoticeable within the first few minutes.
  5. Wait and see memory usage slowly climb upwards (Use the F3 menu; the top right corner shows memory usage); it usually takes less than fifteen minutes to see a noticeable increase in memory usage when using multiple sieves. I believe more fake players interacting with the sieve increases the rate at which memory leaks.
  6. Eventually, you will see a crash. This usually takes me around 20 minutes to an hour and thirty minutes; I think it depends on how much memory has been allocated, and how many automated sieves I have running.

Minecraft Version

1.20.X

Forge Version

NeoForged 47.1.106

Ex Nihilo: Sequentia Version

5.0.0-build.8.jar

Additional Context

I am hosting a server for my friends. Ex Nihilo Sequentia is installed on this server, and mesh damage is enabled (not sure if this is helpful or not to say; meshes are configured to have low durability on our server.) After constructing an automatic sieving setup using Click Machines, I noticed climbing memory usage causing the server to hang and/or crash about an hour after starting it. I tried adding mods to the server like Memory Leak Fix, as well as some improved JVM garbage collection arguments like -XX:+UseG1GC, but these only smoothed out the slow rise in memory. I spent some time narrowing down what was causing the memory leak, eventually thinking it was Click Machines (see Shadows-of-Fire/ClickMachine#54). However, upon testing sieves with Create deployers, the memory leak still occurred -- this led me to believe this was an issue with Ex Nihilo Sequentia itself.

Note that from my experiences, this appears to affect dedicated and internal servers more than remote clients; both servers and singleplayer worlds I tested on have crashed, but I have not yet seen a remote client connected to a server crash due to this issue.

Log File

This gist contains two log files from separate modded instances (ClickMachine log is of a barebones instance, CreateDeployers log is of a more heavily modded instance). Also contains the Ex Nihilo Sequentia config file used in both tests.
https://gist.github.com/Daxturus/d8c9e92a5eead625ec5790b9dfc3470f

commented

I believe I have discovered the issue. However, backporting this to 1.20.1 is going to be difficult. Is there anyway that you can update to 1.20.6?

commented

Do you mean updating for testing, or for using a fixed version of the mod for our server? I can run some tests for Ex Nihilo on 1.20.6 if needed.

However, our server uses mods like BiggerReactors, Advanced Peripherals, Create: Destroy, Rechiseled: Create, Create: Enchantment Industry, and Create: The Factory Must Grow (lots of create addons), which only exist for 1.20.1 at the moment. A lot of our current infrastructure and builds revolve around these mods. Unfortunately, because of this, we can't really update yet, without losing lots of progress or potentially bricking our world.

We mainly decided to install Ex Nihilo Sequentia as a means to generate infinite resources in a hopefully controlled and balanced manner. (Automating string mesh production without automated direct sources of string balances the mod quite nicely in my opinion). If a fix for 1.20.1 is too difficult or impossible, do you have any suggestions for an alternative mod that can do something similar? Whatever happens, thank you for looking into this; if the issue is fixed for 1.20.6, we'll update to it some day.

commented

you're lucky that i haven't updated my repo for 1.20.6 version so an update for 1.20.1 is still possible for me. i already have a version that is under review by nova. so we'll come back to this shortly. :)

commented

Thank you very much! That's reassuring to hear. I'll keep an eye out for any updates in the future.

commented

Can you verify with this file that the OOM has been resolved? I only tested the click mashines with 9 sieves.
Exnihilojar.zip
(as zip file as I can't attach jar files)

commented

After an hour of testing Click Machines with sieves, my world's memory remains solidly less than 20%. Seems fixed, at least for Click Machines!
2024-08-16_11 26 28
I am still testing with Create deployers. I'll have the results for those in around 30 minutes.

commented

Oops, just realized I was testing Create Deployers with the unpatched version of Ex Nihilo Sequentia installed. (I just booted up my server modpack without thinking. As before, it ran out of memory and crashed). My mistake, I will run the test again with the patched version.

commented

Excellent news: Looks like there's no memory leak with the new patch when using Create's deployers with Ex Nihilo Sequentia sieves. Memory use has been stably hovering around 60 to 70 percent since I opened the test world, and I've been running the world for about an hour. (This may seem like a high memory usage, but note that I have my 70 other server mods installed in this test world, and I only have four gigabytes allocated.) I am pretty sure the issue is resolved; once again, thank you very much for your help.

commented

New version is publicly available.