Placing heatpipes causes neighbour tile updating spinlock
Vectrobe opened this issue ยท 3 comments
Describe the bug
The update-neighbour logic of the heatpipes ends up in a severe self-recursion loop, so much so that the server side thread completely locks up for several seconds until the safeguard kicks in, with this event logged to the console as a major, non-crashing error, as so;
[Server thread/ERROR] [minecraft/CollectingNeighborUpdater]: Too many chained neighbor updates. Skipping the rest. First skipped position: xxx, yyy, zzz
with xxx yyy zzz being the coordinates of one of the heatpipes appropriately
How to reproduce the bug
Create a simple empty creative flat world, spawn in a good amount of misc entities (or leave on non-peaceful so slimes are abound), then select heatpipe and start placing a line down, you should notice all the mobs suddenly freeze in place, and if you have "the one probe" installed this will also mention "waiting for server", check the console for it to eventually have the aforementioned error logged at least once, but possibly several, times.
Expected behavior
well obviously not this
Additional details
I suspect the cause might be a call to update neighbours while within a function that is called by this, effectively resulting in as little as two pipes creating an update ping-pong.
This does also occur during world start and chunk loading, but not during tessellation (ie render-side) updates, so if the amount of pipes is long enough this could potentially crash the server thread from stack exhaustion...
Which Minecraft version are you using?
1.19
Which version of PneumaticCraft: Repressurized are you using?
1.19.2-4.3.2-21
Crash log
No response
Yeah, that's definitely not right - there's definitely way too many block updates going there.
Odd thing is, that code hasn't really changed in ages, and it doesn't happen in the 1.18.2 version of the mod. So something related has changed recently...
Think I have it fixed (and looking at the previous code, I'm not sure how it ever worked... definitely falls into the "what was I thinking" category).
Are you in a position to test a dev build? https://modmaven.dev/me/desht/pneumaticcraft/pneumaticcraft-repressurized/1.19.2-4.3.2-SNAPSHOT/pneumaticcraft-repressurized-1.19.2-4.3.2-20230225.115017-3.jar should work a lot better, and seems to behave for me so far. Will probably get a 4.3.3 release out in the next day or two, but would be good to get a bit more testing on this...