Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix quantum bridge infinite update loop #7558

Merged

Conversation

shBLOCK
Copy link
Contributor

@shBLOCK shBLOCK commented Jan 13, 2024

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() and sideB.getNode() return null:

sideA.connection = sideB.connection = new ConnectionWrapper(
GridHelper.createConnection(sideA.getNode(), sideB.getNode()));

The exception is caught here (the debug message won't be shown if debug log is not enabled in config):
} catch (Throwable err) {
AELog.debug(err);
} finally {
setModificationInProgress(null);
}
this.disconnect();

Here it first calls setModificationInProgress(null), which suppresses the update loop protection. Then it calls this.disconnect() which generates block updates causing further calls to MBCalculator.calculateMultiblock() that does go through as a result of setModificationInProgress(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.

@shartte
Copy link
Member

shartte commented Jan 14, 2024

Thank you for this detailed PR, especially the AELog.debug is an old AE2 staple. It used to do that for packet-crashes too :-|

9 year old technical debt:
image

@shartte shartte merged commit 332da22 into AppliedEnergistics:main Jan 14, 2024
1 check passed
shartte pushed a commit that referenced this pull request Jan 14, 2024
Account for quantum bridge nodes not being initialized when neighbor updates trigger multiblock updates.
Stop swallowing exceptions during multiblock updates, since that hid this problem for years, preventing it from being fixed.

---------

Co-authored-by: Sebastian Hartte <shartte@users.noreply.github.com>
(cherry picked from commit 332da22)
shartte pushed a commit that referenced this pull request Jan 14, 2024
Account for quantum bridge nodes not being initialized when neighbor updates trigger multiblock updates.
Stop swallowing exceptions during multiblock updates, since that hid this problem for years, preventing it from being fixed.

---------

Co-authored-by: Sebastian Hartte <shartte@users.noreply.github.com>
(cherry picked from commit 332da22)
@shartte
Copy link
Member

shartte commented Jan 14, 2024

Backported to 1.20.1 Forge/Fabric

Probable cause was: https://github.com/AppliedEnergistics/Applied-Energistics-2/pull/7045/files#diff-f5330fe117da09408d9b84f6010bed9c01d22af51e4a0da9a3cbb05b6a241bd8L191

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants