Compact Machines

Compact Machines

65M Downloads

Machine is not staying chunkloaded -> results in client/server crashes upon entering machine

sesgoe opened this issue · 40 comments

commented

Compact Machines version: compactmachines3-1.12.2-3.0.11-b207
Forge version: 14.23.3.2673
I am not using Optifine: Correct
Link to Crashlog: server pseudo crash log here
client crash log upon trying to load into dimension here
Screenshot (if possible): here

This screenshot is showing the minecraft game output that shows reccomplex showing that forge population isn't being triggered, which seems indicative to me of a chunk unloading issue.

Description of the problem including expected versus actual behavior: CM appears to be unloading one of the compact machines I am using around my base. I am currently using two machines:

One has some mekanism stuff in it for power generation, the other is running 6 IC2 nuclear reactors. I consistently crash approx 70-80% of the time I attempt to enter the 2nd machine involving the nuclear reactors. Once I leave the machine, it stops sending power through one of the tunnels, and if I re-enter the machine, the game crashes.

The crash is a slow crash--you go through the dimension transition, and you can then open/close inventory, but the dimension will never load and you are forced to eventually quit/close minecraft.

Steps to reproduce:

Go inside one of my base's compact machines -> this sometimes crashes immediately

If that fails, go inside -> go outside, wait approx 2-3 minutes -> go back inside -> guaranteed crash.

Happy to provide the map files, etc. if anyone is interested in trying to nail down what exactly is causing it. I've given it a few hours of poking around, but I'm not entirely sure of what I'm even looking at yet.

All I know is that ultimately one of my compact machines is not forcing its chunks to be loaded properly and thus crashes the game when you try to enter what I assume is an unloaded area.

This happens in both "load chunks if machine is chunkloaded" and "always keep chunkloaded" CM settings.

commented

This looks like an issue in Recurrent Complex and its assumption that dimensions always want World Generation in the first place.
The first message I get when running CM and RC at the same time is this:

[15:53:44] [Server thread/ERROR]: Chunk finished generating without Forge population being triggered (dimension 144). This is a bug with the dimension - please report this to the dimension's author. Recurrent Complex will proceed to generate in compatibility mode.

I intentionally bypass Forge population since version 3.0.11, because there should be no world generation in Compact Machine worlds.

I'll have to dig a bit deeper and reproduce your crashes to be sure.

commented

Wait, you bypass world generation entirely? That’s a thing you can do? I thought you just generated empty space.

commented

@thraaawn

Let me know what you find out--I'm available later today (~5PM EST) if you need confirmation about any details about my crashes. Happy to help debug as needed.

The odd thing is that I can get inside the compact machine about 30-40% of the time, but it always seems to unload itself within a few minutes of leaving it.

I'll try removing RC around lunch time to see if the crashes stop.

commented

I bypass chunk population entirely, yes. It seems to be a bit buggy still 😢
The problem with generating empty space and normal forge population is that other mods can still generate in it, which I don't want them to do since it causes issues like #316.

But I already have an idea and maybe a fix for what's causing this issue.
@sesgoe Could you retry with the latest build 208 please? You can grab it from here

commented

@thraaawn
What's the easiest way for me to build it to try it out? Do I need to set up a forge dev environment or can I just build it quickly with gradle?

commented

Sorry, I wasn't finished writing the comment when the commit closed the issue and reopening sent what I already wrote. See my previous comment for a download link.

commented

@thraaawn
Ohhh--gotcha. I will try this out in approx 30-40 minutes and let you know what happens.

Thanks!

commented

Awesome! A bit background info: I couldn't exactly reproduce your issue, but I noticed the CM world got unloaded when it should not. This fix prevents the CM world from being unloaded in the first place, since I assume that's what caused your crashes.

commented

That would be my guess on the crashes too--Thanks so much for the quick response, can't wait to try it out!

commented

Dude. I just saw this was your first issue ever. Excellent job! And sticking around for retesting. A programmers dream 🥇

I'll try to get behind serious crashes like this as soon as possible, especially with the mod being in some major modpacks since 1.12.

commented

I'm actually a software developer by trade, just very little experience with forge, otherwise I would've tried to fix this and just submit a pull request. :)

commented

You can grab the latest build from the same dropbox link, it has the NoPopulateChunk hack removed and should work as before. Unless chunkloading has always been broken and it didn't get noticed until now.

commented

@thraaawn
Alright, gonna try latest real quick and see if it works properly. I'll provide a video if this doesn't work as expected.

commented

If it does work, I'll release a new build to curse.
If it doesn't, then my hack did not actually break anything and I can fix some other issues before releasing a new version.

commented

It seems like the industrialcraft stuff in the machine isn't staying loaded. Video coming up for reference. Will add to this comment when it uploads.

https://youtu.be/66no9b84tKA

So at the end I hop into the 2nd machine--it works fine, and is all mekanism/draconic evolution/thermal expansion stuff.

Assuming this issue is with IC2 and not compact machines, but I'm not sure.

commented

Hmm, i see. That's weird.
I'll try to look into this tomorrow after work and see what IC2 is doing that it stops ticking.

commented

@thraaawn If you want I can close this issue and open a new one for IC2 ticking.

If this gets closed, I'll throw a note at the end saying that Siren island generation needs to be disabled from Ice & Fire for a temp-fix.

commented

@thraaawn
Update: this appears to have fixed the issue. I am hopping in and out of the machine with no issues, and it's sending power through the tunnel properly as expected.

Thanks so so much. Seems like you can upload the new build to curseforge--I'm using the Enigmatica 2: Expert pack and I know of several people playing it who will likely eventually run into the same issue.

If I run into any more problems I'll open a new issue.

commented

Spoke too soon apparently--same crash is still happening--it just takes a few minutes for the chunk to become unloaded and now I'm crashing upon entry to the machine again.

commented

Going to try a new run without recurrent complex loaded and see what happens.

commented

Alright, tried without recurrent complex running and still got unloaded and eventually crashed.

I can initially enter the machine with no issues, but as soon as I leave, it starts becoming unloaded within a few minutes (assuming the GC is maybe responsible?).

commented

Awesome. Thank you very much! Oh, I only read the first comment.
I'll look into it again.

commented

@thraaawn
I'm available for 30-40 more minutes from this comment (then I'm back @ work until 5 PM EST).

Gonna blacklist dimension 144 in the cofh configs of this pack and see if maybe that's causing issues.

commented

@thraaawn

Do you think that going from version like 3.0.7 -> current would cause issues with some of the chunks not being minecraft:void type?

I might try wiping out the dimension and regenerating it and seeing what happens.

commented

No, that shouldn't be a problem - I'm not depending on the biome being set to Void.
I can't reproduce this by unloading the machine itself. This is all weird.

Could you try running jstack (should be included in your jre/jdk) against the minecraft process when the lockup/endless loop happens?
Something like jstack -l <pid-of-minecraft-jvm-process>

You might want to run it multiple times in short succession to see what the Minecraft Server Thread is hanging in.

commented

@thraaawn
https://pastebin.com/yjV7yuts

Here's a jstack against it once the game eventually freezes when trying to close it.

commented
"Server thread" #96 prio=5 os_prio=0 tid=0x000000007b895000 nid=0x2af8 runnable [0x00000000a258e000]
   java.lang.Thread.State: RUNNABLE
    at net.minecraft.world.World.func_175623_d(World.java:229)
    at com.github.alexthe666.iceandfire.structures.WorldGenSirenIsland.func_180709_b(WorldGenSirenIsland.java:30)

This is #316. This should not be happening anymore, since chunks are not being populated in the first place. What the heck?

I must be missing a place where chunks are being processed and probably reloaded as net.minecraft.world.chunk.Chunk instead of org.dave.compactmachines3.world.NoPopulateChunk.

I guess my fix for #316 isn't working after all and it's still on ice and fire to fix.
I'll keep looking for a bit, but then I'll probably revert my NoPopulateChunk fix.

Edit: Yupp, it's being reloaded as Chunk, which totally makes sense. What's weird is that it's still populating it. Maybe some world re-gen is being triggered. 😢

commented

@thraaawn

https://www.youtube.com/watch?v=7eYAGE-WhXw&feature=youtu.be

Got a quick clip of what it looks like when it crashes, sorry for the garbage quality, I wanted the upload to be quick.

commented

@thraaawn

Could be thaumcraft's retroactive re-gen?

If Ice & Fire is the cause I can try without the mod and see if that works?

commented

Thanks for the video.

The best/fastest solution I'm aware of at the moment is to revert my fix since it's not helping and create a pull request for Ice and Fire, which has an endless while() loop in it as described in AlexModGuy/Ice_and_Fire#656.

Yes, removing Ice & Fire should resolve your issues.
Chunkloading issues should be gone when I revert my broken fix.

commented

@thraaawn
Loaded world without Ice & Fire and it worked as expected finally.

Gonna try it without siren island generation enabled to see if that works as a temp fix for this pack.

commented

@thraaawn
So loading without the siren island generation seems to work too--this is totally fine for temp fix for now.

Thanks for helping figure out what the problem was! Sorry this was such a pain.

commented

Thank you! Good to know my patch didn't help, but only caused more crashes and hotfixes.
I'm working on a small PR for Ice&Fire now, hopefully it will get merged (soon).

commented

So some more testing:

I can hop in and out of the machine now thankfully, but the inside isn't staying loaded for some reason. As soon as I hop out it stops transferring power through the tunnel, which I assume means the machine is becoming unloaded for some reason.

I have 2 machines, and one of them works fine which is why I'm so befuddled.

Will be able to test more later this evening.

commented

@thraaawn

Did some more testing--So if I use either IC2's chunk loader, or FTB Utilties Chunk Loading from the mini-map thing, if you load all 9 chunks centered on the compact machine chunk, the ic2 stuff works and is chunkloaded as expected.

Are the compact machines guaranteed to be inside a single chunk?

commented

Yes, they are always fit inside a single chunk for optimization.
Not sure whether I want to chunkload all 8 neighboring chunks as well.
I'll have to think about that.

commented

I mean I would err on the side of only loading the single chunk--maybe an option to load surrounding too? My main question is why does ic2 need the neighboring chunks to be loaded too?

From a player perspective it's a mod that is so far behind the times anyway, and seems to be the only mod I've thus far encountered with the small problem.

Either way, can probably close this issue whenever you'd like, I played for several hours yesterday and encountered no further issues.

commented

A summary of this issue before I go ahead and close it for those who run into the same problem for the future:

1: If you have Ice & Fire minecraft forum curseforge github installed, you will need to disable Siren Island generation if you also have Compact Machines installed until @thraaawn 's pull request: here gets implemented into Ice & Fire.

For me personally, I ran into this issue with the Enigmatica 2: Expert mod pack, so if you're using that pack, this might apply to you if you run into problems.

2: Industrialcraft 2 machines require the surrounding 8 chunks around the Compact Machine chunk to also be loaded in order to function properly while you are no longer in the machine. Any standard chunkloading method seems to work fine (FTBUtilities through the map, IC2's own chunkloader set to load 9 chunks, etc.).

Thanks to @thraaawn for helping diagnose and ultimately fix this issue among others. I'm going to mark this as closed since the bulk of the issue was resolved/fixed/found to be with another mod.

If you're interested in discovering more details, feel free to read the above thread.

commented

-Stumbled upon this in 2020
For anyone reading this, it still applies today. IC2 Nuclear Reactors check to see if the neighboring 8 chunks are loaded. Perhaps this is to make sure any Reactor Chambers are also loaded since it is a multiblock.

Here is Chocoheads words on the matter: "Reactors will check that the surrounding area 8 blocks out is also chunk loaded, it is possible that this is why you're not seeing it work"
https://bt.industrial-craft.net/view.php?id=2286

commented

@thraaawn
as I can see you know your stuff and well Im an idiot in this field so if possible I would like to ask for your help
since this is closed idk if you will get this but if you will and you ave some free time you can contact me on [email protected]