Create

Create

86M Downloads

Hose Pulley counts "flowing" blocks towards infinity threshold, can cause persistent server crash

Zincfox opened this issue · 3 comments

commented

Describe the Bug

Hose pulley crashes the server when the source of the fluid can only be reached after visiting at least fluids.hosePulleyBlockThreshold non-source blocks.
The resulting crash is persistent in that it occurs again once the hose-pulley is loaded, even resulting in crash-on-start when the offending chunk is chunk-loaded.

The "Reproduction Steps" show this for a threshold of 4, but this can easily happen for the default value too if the "non-source"-pool is large enough (eg. draining the fluid of a chunk-hole made with a horizontal drill array from the bottom).

How to "fix" the persistent crash if it happens to you:

  1. Make a backup of your world! (seriously, the damage possibly caused by this "fix" is irreversible)
  2. Open saves/<world>/serverconfig/forge-server.toml, change removeErroringBlockEntities to true
    2.1 This causes forge to delete all TileEntities which are causing errors, including our hose pulley
  3. Load the world in Minecraft, visit/load the offending chunks
  4. Close minecraft, reset removeErroringBlockEntities to false (prevent data-loss if something similar happens again)

Reproduction Steps

See screenshot for an example

  1. Set fluids.hosePulleyBlockThreshold to 4
  2. Dig a 1 block wide and 6 blocks deep hole, place water at the top (1 source block and 5 flowing blocks)
  3. Place hose pulley above hole, lower to varying depths and attempt to pull fluid with pump
  4. Observed result if hose is lowered x blocks into the hole:
    3.1 x<=4: Source block is consumed, pump extracts water ✔️
    3.2 x==5: Source block is not consumed, pump extracts water --> Infinite ⚠️
    3.3 x>=6: Server crashes ❌

Expected Result

  • the source block should be consumed for x>=5 too or no fluid should be extracted (Only source blocks should be counted towards fluids.hosePulleyBlockThreshold)
  • the server should not crash for x>=6

Screenshots and Videos

2023-04-16_01 59 47
(This is the "Infinite" position from "Reproduction Steps")

Crash Report or Log

https://pastebin.com/vStWgWCG

Operating System

Windows 10

Mod Version

0.5.0i

Minecraft Version

1.19.2

Forge Version

43.2.4

Other Mods

  • JEI (11.6.0.1013)

Additional Context

Probably related to #4250 (exception type and location match)

commented

Probably related code snippets:

  • In FluidManipulationBehaviour.search#150: visited.size() <= maxBlocks compares count of all visited blocks (source and non-source) to maxBlocks loaded from config
  • In FluidDrainingBehaviour.continueSearch#280-288: While-Loop assumes that at least 1 source-block has been queued after visiting maxBlocks, causes (after multiple iterations, consuming the whole queue) NoSuchElementException when queue does in fact not contain any source blocks at this point.
commented

I would further suggest clarifying the config-comment of hosePulleyBlockThreshold to differentiate between source and non-source blocks. Previously to checking the code I incorrectly assumed that "number of fluid blocks" meant "number of source blocks", which made more sense from a balancing perspective.
It should further be noted that if only the crash is fixed but the non-source blocks still count towards the "infinity-limit" and the fluids extraction is allowed, most fluids could still be duplicated from one single bucket.

commented

fixed in dev