Steps to reproduce
Load
Flip the lever on the observer to dispense all water.
Flip again to pick up all water. This verifies that the system is working as designed.
Flip the lever on the observer to dispense all water.
Flip again to pick up all water, and then quickly save & quit before all of the water is picked up.
Reload the world.
If desired, clear all water and replace all water bucket dispensers with lava bucket dispensers to confirm and repeat all steps to confirm that the issue occurs with lava as well.
Expected result
All of the water (or lava) gets picked up after you reload.
Observed result
Sometimes one dispenser fails to pick up water (or lava).
Related issues
is duplicated by
Attachments
Comments



Can confirm in 1.20.80.21 Preview.

Here are three theories as to why this happens:
Dispensers that had been activated in the tick before relogging activate again in the first tick after relogging, so they re-dispense water they had picked up. This would stem from the redstone tick system processing different things in alternating game ticks (sometimes called "producer" and "consumer" ticks), and the possibility that the game does not remember which part of a redstone tick was last run when it saves a world, so it always resumes on the same kind of tick. In support of this theory, the chance of the steps above exhibiting the bug seems to be 50/50, and it could also explain why lit redstone dust triggers observers on relog (MCPE-29548; if the dust briefly changes to unlit on the first tick after relog because of which part of a redstone tick the world starts on at load).
Dispensers that were activated by redstone power just before relogging but had not yet executed their action forget that they had a pending action, similar to powered repeaters forgetting their delay with relog (MCPE-58151). This does not seem likely given that dispensers do use pending ticks to schedule their actions, unlike repeaters. However, along the lines of the first theory, since dispensers have a full redstone tick delay, it may be that they only do the pending tick scheduling on the tick after they receive a redstone pulse, and relogging may cause them to forget that they had received a pulse.
Something about liquid flow interferes with the dispenser activation on relog. Water uses pending ticks to schedule spreading and drying up, and dispensers use pending ticks to schedule their actions. Maybe there is some interference or shuffling or cancelling of pending ticks on relog? Maybe the pending tick scheduled by the dispenser to remove the water gets cancelled by the water re-checking whether it can flow on relog? In support of this theory, I can only reproduce the issue where already-existing water (or lava) is able to flow. I cannot reproduce the issue when dispensing water, and I cannot reproduce it when picking up powdered snow or water that is trapped in 1x1x1 spaces.

Dimension::tickRedstone() is the function responsible for evaluating redstone circuits every other game tick. It roughly looks like this:
if( redstone_counter >= redstone_counter_max) THEN
evaluate circuit system
redstone_counter = 0
endif
redstone_counter += 1 // Redstone counter is always either 1 or 2.
In the Dimension::Dimension() constructor both redstone_counter and redstone_counter_max are initialized to 2, such that the circuit system will be evaluated on the first time `Dimension::tickRedstone()` is called after startup. This results in a 50/50 chance that a server will evaluate redstone circuits on even or odd ticks, depending on what the game time values is when a server restarts.
You can see this happen in game by triggering a command block to run the command "time query gametime" on a redstone pulse. Sometimes it will output even number and othertimes it will output odd numbers.
For any redstone components that utilize pending ticks or require precise timing, changing the parity of redstone ticks across restarts can cause them to behave in undefined ways.
The solution is likely simple: initialize redstone_counter to 2 or 1 based on whether the game time is odd or even. This would ensure that redstone ticks are synchronized across restarts.