CaffeineMC / sodium

A Minecraft mod designed to improve frame rates and reduce micro-stutter
Other
4.79k stars 812 forks source link

Crash attempting to free null staging buffer in dev de15676 when joining modded network game #849

Closed gniftygnome closed 3 years ago

gniftygnome commented 3 years ago

Version information

mc1.17.1-0.3.0+rev.de15676-dev.jar

Reproduction Steps

There are a lot of mods loaded and this is arm64 so I am not sure how easily this can be reproduced. I am willing but I won't have time to set up a server and try this with fewer mods for a couple weeks probably. However I think the problem is pretty straightforward even if the cause may not be so I hope you may be able to fix it properly without a reproduction. Also I am including a probably incorrect fix that is working for me in the additional info below.

That said...

  1. Install a server with the following mods: (The version of Ducts in use is a build of the current master of https://github.com/gniftygnome/Ducts )

architectury-2.4.25-fabric.jar armor-stand-editor-1.3.1+1.17.1.jar bettersafebed-fabric-1.17-1.4.jar BetterStrongholds-Fabric-1.17-1.1.1.jar betterthanmending-1.3.0.jar Candlestick-1.1.1.jar caracal-1.17-1.3.11.jar Cardinal-Components-API-3.1.1.jar carrier-1.8.0.jar connectiblechains-1.17.1-1.2.2.jar Couplings-1.5.1+1.17.jar Croptopia-1.17-FABRIC-1.6.1.jar custom-item-range-combination-1.0.1.jar custom-portals-2.1.0.jar deepslatecutting-1.2.0.jar ducts-1.1.4+gnifty1.jar elytratrinket-fabric-2.0.1-1.17.jar fabric-api-0.38.0+1.17.jar fabric-chunkpregen-0.3.4.jar fabric-language-kotlin-1.6.3+kotlin.1.5.21.jar ferritecore-3.0.1-fabric.jar goosiks-villager-hats-mc1.17-1.2.0.jar graves-1.0.8+1.17.1.jar indypets-0.7.0.jar invisframes-2.1.0.jar jline4mcdsrv-0.2.0.jar krypton-0.1.4.jar lithium-fabric-mc1.17.1-0.7.3.jar lovely_snails-1.0.3+1.17.jar modmenu-2.0.5.jar mostructures-1.3.0-pre1-1.17.1-fabric.jar multisleep-1.0.jar netherchest-mc1.17.x-2.0.jar notenoughcrashes-3.4.4+1.17-fabric.jar npc-variety-1.17.0-2.1.2.jar Patchouli-1.17-54-FABRIC.jar respawnablepets-1.17-3.jar servertick-mc1.17-1.5.jar shulkerboxtooltip-3.0.1+1.17.jar sodium-fabric-mc1.17.1-0.3.0+rev.de15676-dev.jar starlight-1.0.0-RC3+fabric.1.17.x.jar stoneholm-1.3.jar stonevaults-1.1.0.jar Terralith+v1.5.jar trinkets-3.0.2.jar vanilla-hammers-3.1.2-1.17.jar XaerosWorldMap_1.16.0_Fabric_1.17.1.jar YungsApi-1.17-Fabric-15.jar

  1. Install a client with the following mods:

architectury-2.4.25-fabric.jar armor-stand-editor-1.3.1+1.17.1.jar betterbeds-1.2.0.jar BetterChristmasChests-2.1.0.jar betterf3-1.1.5+1.17.jar bettersafebed-fabric-1.17-1.4.jar BetterStrongholds-Fabric-1.17-1.1.1.jar betterthanmending-1.3.0.jar Candlestick-1.1.1.jar caracal-1.17-1.3.11.jar Cardinal-Components-API-3.1.1.jar carrier-1.8.0.jar chat_heads-0.3.1+1.17.1.jar cleardespawn-1.17.1-fabric0.36.1-1.1.1.jar cloth-config-5.0.37-fabric.jar connectiblechains-1.17.1-1.2.2.jar Couplings-1.5.1+1.17.jar Croptopia-1.17-FABRIC-1.6.1.jar custom-item-range-combination-1.0.1.jar custom-portals-2.1.0.jar dark-loading-screen-1.6.7.jar deepslatecutting-1.2.0.jar DisableCustomWorldsAdvice-1.3.jar ducts-1.1.4+gnifty1.jar dynamic-fps-2.0.5.jar elytratrinket-fabric-2.0.1-1.17.jar fabric-api-0.38.0+1.17.jar fabric-language-kotlin-1.6.3+kotlin.1.5.21.jar ferritecore-3.0.1-fabric.jar goosiks-villager-hats-mc1.17-1.2.0.jar graves-1.0.8+1.17.1.jar indypets-0.7.0.jar InGameAccountSwitcher-Fabric-1.17-7.1.0.jar invisframes-2.1.0.jar item-model-fix-1.0.2+1.17.jar krypton-0.1.4.jar light-overlay-6.0.0-fabric.jar lithium-fabric-mc1.17.1-0.7.3.jar logical_zoom-0.0.11.jar lovely_snails-1.0.3+1.17.jar modmenu-2.0.5.jar mostructures-1.3.0-pre1-1.17.1-fabric.jar multisleep-1.0.jar netherchest-mc1.17.x-2.0.jar notenoughcrashes-3.4.4+1.17-fabric.jar npc-variety-1.17.0-2.1.2.jar Patchouli-1.17-54-FABRIC.jar respawnablepets-1.17-3.jar RoughlyEnoughItems-6.0.268-alpha-fabric.jar servertick-mc1.17-1.5.jar shulkerboxtooltip-3.0.1+1.17.jar sodium-fabric-mc1.17.1-0.3.0+rev.de15676-dev.jar starlight-1.0.0-RC3+fabric.1.17.x.jar stoneholm-1.3.jar stonevaults-1.1.0.jar Terralith+v1.5.jar trinkets-3.0.2.jar vanilla-hammers-3.1.2-1.17.jar vistas-1.4.4.jar Xaeros_Minimap_21.14.1_Fabric_1.17.1.jar XaerosWorldMap_1.16.0_Fabric_1.17.1.jar YungsApi-1.17-Fabric-15.jar

  1. Start the client, connect to the server, get a crash report. This is reliable on the three arm64 systems I have. However it does not reproduce on my amd64 systems.

Crash Report file

crash-2021-08-21_10.27.47-client.txt

Additional information

This patch resolves the problem for me (and so far my kids have not found any more crashes which is something they are pretty good at, heh):

--- a/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/region/RenderRegionManager.java   (revision de156764410113516eb65b359a0dc4aaf6d004b9)
+++ b/src/main/java/me/jellysquid/mods/sodium/client/render/chunk/region/RenderRegionManager.java   (date 1629573673324)
@@ -165,7 +165,8 @@
         }

         this.regions.clear();
-        this.stagingBuffer.delete(commandList);
+        if (this.stagingBuffer != null)
+            this.stagingBuffer.delete(commandList);
     }

     public Collection<RenderRegion> getLoadedRegions() {

I suspect this issue may be (like issue #841) related to commit bb33a03 (but I am far from competent to say so).

jellysquid3 commented 3 years ago

Your analysis is correct here. :slightly_smiling_face: It's now fixed in Sodium 0.3.1.