RaphiMC / ImmediatelyFast

Speed up immediate mode rendering in Minecraft
https://modrinth.com/mod/immediatelyfast
GNU Lesser General Public License v3.0
293 stars 21 forks source link

Crash during startup: unsafe memory access #143

Closed Vavency closed 6 days ago

Vavency commented 11 months ago

Starting the game after a few launches will crash it. The only remedy is to reboot the system.

Safely starts on 1.1.28 Seems to start fine with 1.2.0 JVM crash with 1.2.1 Consistent crashes after 1.2.2

Possibly caused by a dirty shutdown of the game?

---------------------- OS: GNU/Linux 6.5.12-201.fsync.fc38.x86_64 Java Version: OpenJDK 17/21 MC Version: 1.19.2 Loader: Fabric Mod version: 1.2.7+1.19.2

---------------------- Crash log:

---- Minecraft Crash Report ----
// My bad.

Time: 2023-11-26 14:57:10
Description: Rendering overlay

java.lang.InternalError: a fault occurred in an unsafe memory access operation
    at jdk.unsupported/sun.misc.Unsafe.copyMemory(Unsafe.java:573)
    at org.lwjgl.system.MultiReleaseMemCopy.copy(MultiReleaseMemCopy.java:39)
    at org.lwjgl.system.MemoryUtil.memCopy(MemoryUtil.java:1854)
    at fabric.net.raphimc.immediatelyfast.feature.fast_buffer_upload.PersistentMappedStreamingBuffer.addUpload(PersistentMappedStreamingBuffer.java:101)
    at net.minecraft.class_291.redirect$zkf000$immediatelyfast$optimizeVertexDataUploading(class_291.java:570)
    at net.minecraft.class_291.redirect$zkf000$immediatelyfast$optimizeVertexDataUploading$mixinextras$bridge$19(class_291.java)
    at net.minecraft.class_291.method_43442(class_291.java:72)
    at net.minecraft.class_291.method_1352(class_291.java:45)
    at net.minecraft.class_286.method_43439(class_286.java:54)
    at net.minecraft.class_286.method_43438(class_286.java:31)
    at net.minecraft.class_286.method_43433(class_286.java:26)
    at net.minecraft.class_332.method_25295(class_332.java:241)
    at net.minecraft.class_332.method_25297(class_332.java:223)
    at net.minecraft.class_332.method_25293(class_332.java:207)
    at net.minecraft.class_425.method_25394(class_425.java:125)
    at net.minecraft.class_757.method_3192(class_757.java:870)
    at net.minecraft.class_310.method_1523(class_310.java:1177)
    at net.minecraft.class_310.method_1514(class_310.java:768)
    at net.minecraft.client.main.Main.method_44604(Main.java:244)
    at net.minecraft.client.main.Main.main(Main.java:51)
    at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:470)
    at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74)
    at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)

A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Render thread
Stacktrace:
    at jdk.unsupported/sun.misc.Unsafe.copyMemory(Unsafe.java:573)
    at org.lwjgl.system.MultiReleaseMemCopy.copy(MultiReleaseMemCopy.java:39)
    at org.lwjgl.system.MemoryUtil.memCopy(MemoryUtil.java:1854)
    at fabric.net.raphimc.immediatelyfast.feature.fast_buffer_upload.PersistentMappedStreamingBuffer.addUpload(PersistentMappedStreamingBuffer.java:101)
    at net.minecraft.class_291.redirect$zkf000$immediatelyfast$optimizeVertexDataUploading(class_291.java:570)
    at net.minecraft.class_291.redirect$zkf000$immediatelyfast$optimizeVertexDataUploading$mixinextras$bridge$19(class_291.java)
    at net.minecraft.class_291.method_43442(class_291.java:72)
    at net.minecraft.class_291.method_1352(class_291.java:45)
    at net.minecraft.class_286.method_43439(class_286.java:54)
    at net.minecraft.class_286.method_43438(class_286.java:31)
    at net.minecraft.class_286.method_43433(class_286.java:26)
    at net.minecraft.class_332.method_25295(class_332.java:241)
    at net.minecraft.class_332.method_25297(class_332.java:223)
    at net.minecraft.class_332.method_25293(class_332.java:207)
    at net.minecraft.class_425.method_25394(class_425.java:125)
Mixins in Stacktrace:
    net.minecraft.class_291:
        fabric.net.raphimc.immediatelyfast.injection.mixins.fast_buffer_upload.MixinVertexBuffer (fabric-immediatelyfast-common.mixins.json)
    net.minecraft.class_332:
        fabric.net.raphimc.immediatelyfast.injection.mixins.hud_batching.consumer.MixinDrawableHelper (fabric-immediatelyfast-common.mixins.json)

-- Overlay render details --
Details:
    Overlay name: net.minecraft.class_425
Stacktrace:
    at net.minecraft.class_757.method_3192(class_757.java:870)
    at net.minecraft.class_310.method_1523(class_310.java:1177)
    at net.minecraft.class_310.method_1514(class_310.java:768)
    at net.minecraft.client.main.Main.method_44604(Main.java:244)
    at net.minecraft.client.main.Main.main(Main.java:51)
    at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:470)
    at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74)
    at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)
Mixins in Stacktrace:
    net.minecraft.class_757:
        fabric.net.raphimc.immediatelyfast.injection.mixins.core.compat.MixinGameRenderer (fabric-immediatelyfast-common.mixins.json)
        net.fabricmc.fabric.mixin.screen.GameRendererMixin (fabric-screen-api-v1.mixins.json)
    net.minecraft.class_310:
        net.fabricmc.fabric.mixin.datagen.client.MinecraftClientMixin (fabric-data-generation-api-v1.client.mixins.json)
        fabric.net.raphimc.immediatelyfast.injection.mixins.hud_batching.MixinMinecraftClient (fabric-immediatelyfast-common.mixins.json)
        net.fabricmc.fabric.mixin.event.interaction.client.MinecraftClientMixin (fabric-events-interaction-v0.client.mixins.json)
        net.fabricmc.fabric.mixin.registry.sync.client.MinecraftClientMixin (fabric-registry-sync-v0.client.mixins.json)
        net.fabricmc.fabric.mixin.networking.client.accessor.MinecraftClientAccessor (fabric-networking-api-v1.client.mixins.json)
        fabric.net.raphimc.immediatelyfast.injection.mixins.core.MixinMinecraftClient (fabric-immediatelyfast-common.mixins.json)
        net.fabricmc.fabric.mixin.screen.MinecraftClientMixin (fabric-screen-api-v1.mixins.json)
        net.fabricmc.fabric.mixin.event.lifecycle.client.MinecraftClientMixin (fabric-lifecycle-events-v1.client.mixins.json)

-- Last reload --
Details:
    Reload number: 1
    Reload reason: initial
    Finished: No
    Packs: Default, Fabric Mods, FullBoard_PBR, FullBoard_PBR_Normals
Stacktrace:
    at net.minecraft.class_6360.method_36565(class_6360.java:49)
    at net.minecraft.class_310.method_1587(class_310.java:2348)
    at net.minecraft.class_310.method_1514(class_310.java:787)
    at net.minecraft.client.main.Main.method_44604(Main.java:244)
    at net.minecraft.client.main.Main.main(Main.java:51)
    at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:470)
    at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74)
    at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)
Mixins in Stacktrace:
    net.minecraft.class_310:
        net.fabricmc.fabric.mixin.datagen.client.MinecraftClientMixin (fabric-data-generation-api-v1.client.mixins.json)
        fabric.net.raphimc.immediatelyfast.injection.mixins.hud_batching.MixinMinecraftClient (fabric-immediatelyfast-common.mixins.json)
        net.fabricmc.fabric.mixin.event.interaction.client.MinecraftClientMixin (fabric-events-interaction-v0.client.mixins.json)
        net.fabricmc.fabric.mixin.registry.sync.client.MinecraftClientMixin (fabric-registry-sync-v0.client.mixins.json)
        net.fabricmc.fabric.mixin.networking.client.accessor.MinecraftClientAccessor (fabric-networking-api-v1.client.mixins.json)
        fabric.net.raphimc.immediatelyfast.injection.mixins.core.MixinMinecraftClient (fabric-immediatelyfast-common.mixins.json)
        net.fabricmc.fabric.mixin.screen.MinecraftClientMixin (fabric-screen-api-v1.mixins.json)
        net.fabricmc.fabric.mixin.event.lifecycle.client.MinecraftClientMixin (fabric-lifecycle-events-v1.client.mixins.json)

-- System Details --
Details:
    Minecraft Version: 1.19.2
    Minecraft Version ID: 1.19.2
    Operating System: Linux (amd64) version 6.5.12-201.fsync.fc38.x86_64
    Java Version: 21, Red Hat, Inc.
    Java VM Version: OpenJDK 64-Bit Server VM (mixed mode, sharing), Red Hat, Inc.
    Memory: 1124867232 bytes (1072 MiB) / 2046820352 bytes (1952 MiB) up to 4294967296 bytes (4096 MiB)
    CPUs: 8
    Processor Vendor: AuthenticAMD
    Processor Name: AMD FX-8320E Eight-Core Processor
    Identifier: AuthenticAMD Family 21 Model 2 Stepping 0
    Microarchitecture: Piledriver
    Frequency (GHz): -0.00
    Number of physical packages: 1
    Number of physical CPUs: 8
    Number of logical CPUs: 8
    Graphics card #0 name: Baffin [Radeon RX 460/560D / Pro 450/455/460/555/555X/560/560X]
    Graphics card #0 vendor: Advanced Micro Devices, Inc. [AMD/ATI] (0x1002)
    Graphics card #0 VRAM (MB): 258.00
    Graphics card #0 deviceId: 0x67ef
    Graphics card #0 versionInfo: unknown
    Virtual memory max (MB): 21274.55
    Virtual memory used (MB): 12638.14
    Swap memory total (MB): 13294.19
    Swap memory used (MB): 2459.25
    JVM Flags: 9 total; -Xmx4096M -XX:MetaspaceSize=256M -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M -Xss1M
    Fabric Mods: 
        fabric-api: Fabric API 0.76.1+1.19.2
            fabric-api-base: Fabric API Base 0.4.15+8f4e8eb390
            fabric-api-lookup-api-v1: Fabric API Lookup API (v1) 1.6.14+93d8cb8290
            fabric-biome-api-v1: Fabric Biome API (v1) 9.1.1+16f1e31390
            fabric-block-api-v1: Fabric Block API (v1) 1.0.2+e415d50e90
            fabric-blockrenderlayer-v1: Fabric BlockRenderLayer Registration (v1) 1.1.25+cafc6e8e90
            fabric-client-tags-api-v1: Fabric Client Tags 1.0.5+b35fea8390
            fabric-command-api-v1: Fabric Command API (v1) 1.2.16+f71b366f90
            fabric-command-api-v2: Fabric Command API (v2) 2.2.1+413cbbc790
            fabric-commands-v0: Fabric Commands (v0) 0.2.33+df3654b390
            fabric-containers-v0: Fabric Containers (v0) 0.1.42+df3654b390
            fabric-content-registries-v0: Fabric Content Registries (v0) 3.5.2+7c6cd14d90
            fabric-convention-tags-v1: Fabric Convention Tags 1.3.0+4bc6e26290
            fabric-crash-report-info-v1: Fabric Crash Report Info (v1) 0.2.8+aeb40ebe90
            fabric-data-generation-api-v1: Fabric Data Generation API (v1) 5.3.9+413cbbc790
            fabric-dimensions-v1: Fabric Dimensions API (v1) 2.1.35+0d0f210290
            fabric-entity-events-v1: Fabric Entity Events (v1) 1.5.4+9244241690
            fabric-events-interaction-v0: Fabric Events Interaction (v0) 0.4.34+562bff6e90
            fabric-events-lifecycle-v0: Fabric Events Lifecycle (v0) 0.2.36+df3654b390
            fabric-game-rule-api-v1: Fabric Game Rule API (v1) 1.0.24+b6b6abb490
            fabric-item-api-v1: Fabric Item API (v1) 1.6.6+b7d1888890
            fabric-item-groups-v0: Fabric Item Groups (v0) 0.3.39+9244241690
            fabric-key-binding-api-v1: Fabric Key Binding API (v1) 1.0.25+5c4fce2890
            fabric-keybindings-v0: Fabric Key Bindings (v0) 0.2.23+df3654b390
            fabric-lifecycle-events-v1: Fabric Lifecycle Events (v1) 2.2.4+1b46dc7890
            fabric-loot-api-v2: Fabric Loot API (v2) 1.1.13+83a8659290
            fabric-loot-tables-v1: Fabric Loot Tables (v1) 1.1.16+9e7660c690
            fabric-message-api-v1: Fabric Message API (v1) 5.0.7+93d8cb8290
            fabric-mining-level-api-v1: Fabric Mining Level API (v1) 2.1.24+33fbc73890
            fabric-models-v0: Fabric Models (v0) 0.3.21+c6af733c90
            fabric-networking-api-v1: Fabric Networking API (v1) 1.2.12+def3f86d90
            fabric-networking-v0: Fabric Networking (v0) 0.3.29+df3654b390
            fabric-object-builder-api-v1: Fabric Object Builder API (v1) 4.2.2+d8ef690890
            fabric-particles-v1: Fabric Particles (v1) 1.0.14+4d0d570390
            fabric-recipe-api-v1: Fabric Recipe API (v1) 1.0.2+413cbbc790
            fabric-registry-sync-v0: Fabric Registry Sync (v0) 0.9.33+9244241690
            fabric-renderer-api-v1: Fabric Renderer API (v1) 1.2.1+1adbf27790
            fabric-renderer-indigo: Fabric Renderer - Indigo 0.8.0+1adbf27790
            fabric-renderer-registries-v1: Fabric Renderer Registries (v1) 3.2.24+df3654b390
            fabric-rendering-data-attachment-v1: Fabric Rendering Data Attachment (v1) 0.3.19+6e0787e690
            fabric-rendering-fluids-v1: Fabric Rendering Fluids (v1) 3.0.11+4d0d570390
            fabric-rendering-v0: Fabric Rendering (v0) 1.1.27+df3654b390
            fabric-rendering-v1: Fabric Rendering (v1) 1.12.1+d8ef690890
            fabric-resource-conditions-api-v1: Fabric Resource Conditions API (v1) 2.1.2+aae9039d90
            fabric-resource-loader-v0: Fabric Resource Loader (v0) 0.8.4+edbdcddb90
            fabric-screen-api-v1: Fabric Screen API (v1) 1.0.32+4d0d570390
            fabric-screen-handler-api-v1: Fabric Screen Handler API (v1) 1.3.8+1cc24b1b90
            fabric-sound-api-v1: Fabric Sound API (v1) 1.0.2+c4f28df590
            fabric-textures-v0: Fabric Textures (v0) 1.0.24+aeb40ebe90
            fabric-transfer-api-v1: Fabric Transfer API (v1) 2.1.6+413cbbc790
            fabric-transitive-access-wideners-v1: Fabric Transitive Access Wideners (v1) 1.3.3+08b73de490
        fabricloader: Fabric Loader 0.14.24
        immediatelyfast: ImmediatelyFast 1.2.7+1.19.2
            com_github_llamalad7_mixinextras: MixinExtras 0.2.0
            net_lenni0451_reflect: Reflect 1.3.0
        java: OpenJDK 64-Bit Server VM 21
        minecraft: Minecraft 1.19.2
        mixintrace: MixinTrace 1.1.1+1.17
        modmenu: Mod Menu 4.1.2
    Launched Version: 1.19.2
    Backend library: LWJGL version 3.3.1 SNAPSHOT
    Backend API: AMD Radeon RX 460 Graphics (polaris11, LLVM 16.0.6, DRM 3.54, 6.5.12-201.fsync.fc38.x86_64) GL version 4.6 (Core Profile) Mesa 23.1.9, AMD
    Window size: 1920x1022
    GL Caps: Using framebuffer using OpenGL 3.2
    GL debug messages: 
    Using VBOs: Yes
    Is Modded: Definitely; Client brand changed to 'fabric'
    Type: Client (map_client.txt)
    Graphics mode: fancy
    Resource Packs: vanilla, Fabric Mods, file/FullBoard_PBR, file/FullBoard_PBR_Normals
    Current Language: English (US)
    CPU: 8x AMD FX-8320E Eight-Core Processor
RaphiMC commented 11 months ago

Can you monitor your GPU and system memory usage while restarting ImmediatelyFast a couple of times

RaphiMC commented 11 months ago

Also provide more details to your linux environment so I can at least attempt to reproduce it

RaphiMC commented 11 months ago

Maybe this can help you fix or narrow down the issue: https://stackoverflow.com/questions/45536049/java-lang-internalerror-a-fault-occurred-in-a-recent-unsafe-memory-access-opera

RaphiMC commented 6 days ago

This is now fixed in the latest version (1.3.1)