Buuz135 / FunctionalStorage

FunctionalStorage
MIT License
30 stars 32 forks source link

[1.20.1] Chunk loading deadlock with FTB Chunks #243

Closed jeremiahwinsley closed 8 months ago

jeremiahwinsley commented 8 months ago

DO NOT REPORT AN ISSUE IF YOU HAVEN'T TESTED THE ISSUE WITH THE LATEST VERSION IN CURSEFORGE

Functional Storage Version: 1.2.6

Titanium Version: 3.8.24

Crashlog If Applicable (Upload to pastebin/gist): https://mclo.gs/U1zxPmf

I have what seems to be a deadlock due to a particular setup with FTB Chunks force-loading a chunk containing a controller extender during player login, and that controller extender attempting to load the chunk containing the controller.

I added this hotfix on the server which fixed the deadlock and got the server running again, but I assume probably not sufficient for an actual fix:

diff --git a/src/main/java/com/buuz135/functionalstorage/block/tile/StorageControllerExtensionTile.java b/src/main/java/com/buuz135/functionalstorage/block/tile/StorageControllerExtensionTile.java
index 3b6e82b..fb98fed 100644
--- a/src/main/java/com/buuz135/functionalstorage/block/tile/StorageControllerExtensionTile.java
+++ b/src/main/java/com/buuz135/functionalstorage/block/tile/StorageControllerExtensionTile.java
@@ -80,6 +80,7 @@ public abstract class StorageControllerExtensionTile<T extends StorageController

     private Optional<StorageControllerTile> getControllerInstance() {
         if (getControllerPos() == null) return Optional.empty();
+        if (level == null || !level.isLoaded(getControllerPos())) return Optional.empty();
         return TileUtil.getTileEntity(this.level, getControllerPos(), StorageControllerTile.class);
     }