TominoCZ / FancyBlockParticles

My MC mod that turns 2D digging particles 3D!
https://minecraft.curseforge.com/projects/fancy-block-particles
GNU General Public License v3.0
18 stars 8 forks source link

Crash. OutOfMemory . MemoryLeak in FBP #111

Open gelonsoft opened 5 years ago

gelonsoft commented 5 years ago

Steps to reproduce issue:

Just playing

MC Version:

1.12.2

FBP Version:

Both FancyBlockParticles-1.12.x-2.4.1.jar and FancyBlockParticles-1.12.x-2.4.0.jar

Forge Version (e.g. 2604):

2707

crash-2018-12-01_08.11.13-server.txt FBP_configs.zip

HeapDump Analysis report (using Eclipse MAT): 1) Top in Dominator tree:

` Class Name | Shallow Heap | Retained Heap | Percentage

com.TominoCZ.FBP.particle.FBPParticleManager @ 0x673b6fec8 | 48 | 3 908 591 144 | 60,31% |- java.util.ArrayDeque @ 0x673b6fff8 | 24 | 3 908 582 680 | 60,31% | '- java.lang.Object[16777216] @ 0x734000000 | 67 108 880 | 3 908 582 656 | 60,31% | |- mods.betterfoliage.client.render.EntityFallingLeavesFX @ 0x6b4e9cb88| 192 | 536 | 0,00% | |- com.TominoCZ.FBP.particle.FBPParticleDigging @ 0x6c88a45f0 | 272 | 536 | 0,00% | |- com.TominoCZ.FBP.particle.FBPParticleDigging @ 0x6c88a4808 | 272 | 536 | 0,00% | |- com.TominoCZ.FBP.particle.FBPParticleDigging @ 0x6c88a4a20 | 272 | 536 | 0,00% | |- com.TominoCZ.FBP.particle.FBPParticleDigging @ 0x6c88a4c38 | 272 | 536 | 0,00% | |- com.TominoCZ.FBP.particle.FBPParticleDigging @ 0x6c88a4e50 | 272 | 536 | 0,00% | |- com.TominoCZ.FBP.particle.FBPParticleDigging @ 0x6c88a5068 | 272 | 536 | 0,00% | |- com.TominoCZ.FBP.particle.FBPParticleDigging @ 0x6c88a5280 | 272 | 536 | 0,00% | |- com.TominoCZ.FBP.particle.FBPParticleDigging @ 0x6c88a5498 | 272 | 536 | 0,00% | |- com.TominoCZ.FBP.particle.FBPParticleDigging @ 0x6c88a56b0 | 272 | 536 | 0,00% | |- com.TominoCZ.FBP.particle.FBPParticleDigging @ 0x6c88a58c8 | 272 | 536 | 0,00% | |- com.TominoCZ.FBP.particle.FBPParticleDigging @ 0x6c88a5ae0 | 272 | 536 | 0,00% | |- com.TominoCZ.FBP.particle.FBPParticleDigging @ 0x6c88a5cf8 | 272 | 536 | 0,00% | |- com.TominoCZ.FBP.particle.FBPParticleDigging @ 0x6c88a5f10 | 272 | 536 | 0,00% | |- com.TominoCZ.FBP.particle.FBPParticleDigging @ 0x6c88a6128 | 272 | 536 | 0,00% | |- com.TominoCZ.FBP.particle.FBPParticleDigging @ 0x6c88a6340 | 272 | 536 | 0,00% | |- com.TominoCZ.FBP.particle.FBPParticleDigging @ 0x6c88a6558 | 272 | 536 | 0,00% | |- com.TominoCZ.FBP.particle.FBPParticleDigging @ 0x6c88a6770 | 272 | 536 | 0,00% | |- com.TominoCZ.FBP.particle.FBPParticleDigging @ 0x6c88a6988 | 272 | 536 | 0,00% | |- com.TominoCZ.FBP.particle.FBPParticleDigging @ 0x6c88a6ba0 | 272 | 536 | 0,00% | |- com.TominoCZ.FBP.particle.FBPParticleDigging @ 0x6c88a6db8 | 272 | 536 | 0,00% | |- com.TominoCZ.FBP.particle.FBPParticleDigging @ 0x6c88a6fd0 | 272 | 536 | 0,00% | |- com.TominoCZ.FBP.particle.FBPParticleDigging @ 0x6c88a71e8 | 272 | 536 | 0,00% | |- com.TominoCZ.FBP.particle.FBPParticleDigging @ 0x6c88a7400 | 272 | 536 | 0,00% | |- com.TominoCZ.FBP.particle.FBPParticleDigging @ 0x6c88a7618 | 272 | 536 | 0,00% | '- Total: 25 of 13 123 995 entries; 13 123 970 more | | |
|- java.util.ArrayDeque[4][] @ 0x673b6ff08 | 32 | 5 632 | 0,00% |- java.util.HashMap @ 0x673b6ffc8 | 48 | 2 624 | 0,00% |- java.util.ArrayDeque @ 0x673b6ff28 | 24 | 104 | 0,00% |- java.util.Random @ 0x673b6ff90 | 32 | 56 | 0,00% '- Total: 5 entries | | |
class com.TominoCZ.FBP.FBP @ 0x5e86c5db0 | 152 | 278 754 224 | 4,30% net.minecraft.launchwrapper.LaunchClassLoader @ 0x5e40954e8 | 128 | 235 232 416 | 3,63% mezz.jei.ingredients.IngredientFilter @ 0x62b63f708 | 48 | 233 996 456 | 3,61%

`

2) Incoming reference on java.lang.Object[16777216] @ 0x734000000 by Object Class:

image

3) Example of One instance of com.TominoCZ.FBP.particle.FBPParticleDigging:

Type |Name |Value

ref |dummyEntity |com.TominoCZ.FBP.particle.FBPParticleDigging$1 @ 0x6554153f0 ref |field_190016_K|net.minecraft.util.math.Vec3d @ 0x769c615c0 double|field_70555_ap|-192.69999998807907 double|field_70554_ao|65.0 double|field_70556_an|-4.699999988079072 ref |field_187121_a|net.minecraft.util.math.AxisAlignedBB @ 0x6317a6120

Type |Name |Value

ref |par |null ref |rotStep |com.TominoCZ.FBP.vector.FBPVector3d @ 0x706519c50 ref |prevRot |com.TominoCZ.FBP.vector.FBPVector3d @ 0x706519c28 ref |rot |com.TominoCZ.FBP.vector.FBPVector3d @ 0x706519c00 ref |facing |null boolean|killToggle |false boolean|destroyed |true boolean|wasFrozen |false boolean|modeDebounce |false double |endMult |0.6201555561036118 double |prevMotionZ |0.0 double |prevMotionX |0.0 double |prevParticleAlpha|0.0 double |prevParticleScale|0.0 double |scaleAlpha |0.494183839559555 double |startY |68.16666666666667 float |prevGravity |0.9 ref |mc |net.minecraft.client.Minecraft @ 0x5e3373f48 ref |sourceState |pl.asie.foamfix.common.FoamyBlockState @ 0x5edd90390 ref |field_181019_az |net.minecraft.util.math.BlockPos @ 0x706519be8 ref |field_174847_a |pl.asie.foamfix.common.FoamyBlockState @ 0x5edd90390 float |field_190015_G |0.0 float |field_190014_F |0.0 ref |field_187119_C |pl.asie.foamfix.client.FastTextureAtlasSprite @ 0x627ca9c58 float |field_82339_as |1.0 float |field_70551_j |1.0 float |field_70553_i |1.0 float |field_70552_h |1.0 float |field_70545_g |0.9 float |field_70544_f |0.6026632 int |field_70547_e |17 int |field_70546_d |0 float |field_70549_c |1.0766976 float |field_70548_b |1.5413356 int |field_94055_c |0 int |field_94054_b |0 ref |field_187136_p |java.util.Random @ 0x706519bb0 float |field_187135_o |0.2 float |field_187134_n |0.2 boolean|field_187133_m |false boolean|field_190017_n |true boolean|field_187132_l |false ref |field_187120_G |net.minecraft.util.math.AxisAlignedBB @ 0x706519b70 double |field_187131_k |0.10008084447547554 double |field_187130_j |0.0478956923624177 double |field_187129_i |0.0562928675161939 double |field_187128_h |-184.16666666666666 double |field_187127_g |68.10640034327905 double |field_187126_f |27.5 double |field_187125_e |-184.16666666666666 double |field_187124_d |68.10640034327905 double |field_187123_c |27.5 ref |field_187122_b |net.minecraft.client.multiplayer.WorldClient @ 0x6754b8878

=======================

TominoCZ commented 5 years ago

This mod isn't serverside mod.

fluffle commented 4 years ago

Hi! I ran into something similar just now and have a repeatable test case if you're interested. The mods involved are Simple Storage Network, Storage Drawers, Mekanism and Tinker's Construct.

Modpack: Sevtech Ages 3.1.2_HF1 FancyBlockParticles version: 1.12.x-2.4.1 ProportionalDestructionParticles version: 1.12.2-1.2.4 JVM Args: -Xms10g -Xmx10g -XX:NewSize=4G -XX:MaxNewSize=4G -XX:+UseG1GC -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50

The Backstory

Everything's been fine on this world for ages. A couple of nights ago I built a large (8x8 internal) smeltery and 32 casting basins so I could make glass efficiently for singularities. I used Mekanism pipes and logistics tubes to move the molten glass from the smeltery to the basins, and from the basins to a storage drawer. SSN was pushing a stack of sand in at a time, and reading the contents of the storage drawer. This was the last thing I did before going to bed.

I started noticing increasing memory usage and GC pressure in my next playing session. After ~3-4h play time there were full GCs occurring every 20-30s; I even saw an OOM exception. Next time I played, the first thing I did was disable feeding sand into the smeltery. All was fine again, no memory increases, no visible GC pauses. I think this is interesting, because I didn't destroy any of the smeltery, the casting basins, the mekanism piping or the storage drawer.

The Details

Today, I left the game running for a while in the background with a bunch of additional JVM flags set so that when an OOM exception triggered it would generate a heap dump. I loaded this up in MAT, and it showed the same symptoms the OP had -- the particle manager queue (a java.util.ArrayDeque stored in field_187241_h of the particle manager) was full of >6M objects. Rough counts are:

The list goes on but these are the top offenders. The heap dump is 8G which is a little large for me to upload anywhere useful, and I don't think it's really going to help much.

Uneducated Theorising

It looks like something is preventing queued particles from being dequeued again, but I don't really know what might do that. I suspect that the particles in the queue are in roughly the proportions the game is creating them in over time -- I have 70-odd Immersive Engineering Cloches running, and each of these constantly emits redstone particle effects when running. Rain and portal particles are self-explanatory, I think. The smoke particles most likely come from the pair of IE diesel generators constantly running, as well as the netherrack/hibachi fires I have running under my Better With Mods gear.

I'm going to disable both FBP and PDP for this next gaming session, and leave the smeltery running. It'll be interesting to see whether the queue still fills without these mods present.

TominoCZ commented 4 years ago

hmm.. well Redstone Particles can be annoying, there is a setting for it that specifically disables those.

Another reason for particles not dequeuing could be that maybe Freeze Mode was toggled ON, another could be that maybe particles are spawning faster than despawning, which you can fix by lowering the particle duration in the FBP Menu.

If that's neither of those cases, then I have no clue :D