Fix quantum bridge infinite update loop #7558
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #7491
Fixes #7342
Fixes #7337
Might be related to #7343, not confirmed.
How To Reproduce
This is consistently reproducible by attempting to load "1024_channels_through_quantum_bridge.snbt" in the guidebook scene area in the testing world.
Originally posted by @Sea-Kerman in #7337 (comment)
The Cause
This issue is actually caused by a NullPointerException here, where
sideA.getNode()
andsideB.getNode()
return null:Applied-Energistics-2/src/main/java/appeng/me/cluster/implementations/QuantumCluster.java
Lines 127 to 128 in 5300718
The exception is caught here (the debug message won't be shown if debug log is not enabled in config):
Applied-Energistics-2/src/main/java/appeng/me/cluster/MBCalculator.java
Lines 148 to 154 in 5300718
Here it first calls
setModificationInProgress(null)
, which suppresses the update loop protection. Then it callsthis.disconnect()
which generates block updates causing further calls toMBCalculator.calculateMultiblock()
that does go through as a result ofsetModificationInProgress(null)
, causing an update loop.I didn't go into why the nodes are null, so I'm not sure if this simple check is the best way to fix it. But I did some testing and everything seems to be working fine, I also ran the Gametests and they are passing.