VulkanMod icon indicating copy to clipboard operation
VulkanMod copied to clipboard

Vulkan Renderer Mod causes OutOfMemoryError: Out of stack space on Minecraft 1.21.1 (RTX 4060, Fabric)

Open HoneyBerries opened this issue 1 year ago • 17 comments

Summary: When enabling the Vulkan Renderer Mod (vulkanmod 0.5.5), Minecraft 1.21.1 crashes on startup with java.lang.OutOfMemoryError: Out of stack space during Vulkan initialization. Removing the mod allows the game to launch normally with the default OpenGL renderer.

Environment:

  • Minecraft: 1.21.1
  • Fabric Loader: 0.17.2
  • Java: OpenJDK 21.0.8.0 (Eclipse Adoptium)
  • OS: Windows 11
  • GPU: NVIDIA GeForce RTX 4060 (latest drivers)
  • VulkanMod: 0.5.5 (bundles LWJGL 3.3.3-snapshot)
  • 119 mods loaded (see log excerpt below for key mods)

Steps to reproduce:

  1. Install Vulkan Renderer Mod (vulkanmod 0.5.5) into a Fabric 1.21.1 instance.
  2. Launch Minecraft with Fabric Loader 0.17.2 and Java 21.
  3. Observe crash during renderer initialization.

Expected behavior: Minecraft initializes the Vulkan renderer and proceeds to the main menu.

Actual behavior: Crash on startup with:

java.lang.OutOfMemoryError: Out of stack space
    at knot//org.lwjgl.system.MemoryStack.nmalloc(MemoryStack.java:322)
    at knot//org.lwjgl.vulkan.VkExtensionProperties.malloc(VkExtensionProperties:210)
    at knot//org.lwjgl.vulkan.VkInstance.getAvailableDeviceExtensions(VkInstance.java:82)
    at knot//org.lwjgl.vulkan.VkInstance.getInstanceCapabilities(VkInstance.java:45)
    at knot//org.lwjgl.vulkan.VkInstance.<init>(VkInstance.java:29)
    at knot//net.vulkanmod.vulkan.Vulkan.createInstance(Vulkan.java:244)
    at knot//net.vulkanmod.vulkan.Vulkan.initVulkan(Vulkan.java:139)
    at knot//net.vulkanmod.vulkan.VRenderSystem.initRenderer(VRenderSystem:63)
    at knot//com.mojang.blaze3d.systems.RenderSystem.initRenderer(RenderSystem:1004)
    at knot//net.minecraft.class_310.<init>(class_310:524)

Startup log excerpt:

[14:15:13] [main/INFO]: Loading Minecraft 1.21.1 with Fabric Loader 0.17.2
...
[14:15:14] [main/INFO]: Loading 119 mods:
  - vulkanmod 0.5.5
     |-- org_lwjgl_lwjgl-shaderc 3.3.3
     |-- org_lwjgl_lwjgl-vma 3.3.3
     |-- org_lwjgl_lwjgl-vulkan 3.3.3
...
[14:15:25] [Render thread/INFO]: == VulkanMod ==
[14:15:25] [Render thread/INFO]: Selecting Platform: WIN32
[14:15:25] [Render thread/INFO]: GLFW: 3.4.0 Win32 WGL Null EGL OSMesa VisualC DLL
[14:15:27] [Render thread/INFO]: Backend library: LWJGL version 3.3.3-snapshot

Attempts and workarounds tried:

  • Closed OBS (graphics-hook previously present in modules) — no effect.
  • Increased JVM stack size (e.g., -Xss2M / -Xss4M) — no effect.
  • Removed Vulkan mod — game launches normally (OpenGL renderer).
  • Verified GPU drivers are the latest for RTX 4060.
  • Verified Vulkan support via driver install (vulkan runtime present).

Notes / Hypothesis:

  • The stack trace shows the failure occurs inside LWJGL's MemoryStack allocation when enumerating Vulkan extensions. This suggests an issue in the way the mod/LWJGL is allocating stack memory or handling the returned extension list (possible bug in the mod or an LWJGL binding mismatch).
  • The environment uses LWJGL 3.3.3-snapshot packaged by vulkanmod; consider testing with a stable LWJGL or reviewing MemoryStack usage in Vulkan.createInstance.
  • There may be interactions with the large mod list or specific mods — testing with only vulkanmod + Fabric was not yet performed.

Workaround:

  • Remove vulkanmod to use default OpenGL renderer.

Please investigate potential improper MemoryStack usage when enumerating Vulkan extensions or any mod conflicts that could cause inflated stack usage during instance creation.

HoneyBerries avatar Aug 30 '25 22:08 HoneyBerries

I encountered the same problem on my rtx 4060. Initially, I was using the 577 version of the video driver, but after playing for a few minutes with the Vulkan mod on 1.21, the driver crashed. I decided to update to the 580.88 version in hopes that it would resolve the issue, but I was unable to even launch the game (java.lang.OutOfMemoryError: Out of stack space). I searched for information about Vulkan changes in the new driver descriptions, but I did not find anything. I'll have to stay on OpenGL for now :(

sskailBrox avatar Sep 01 '25 10:09 sskailBrox

Having the same issue.

Edit: I went on Vulkan discord and start scrolling up in the Off-topic chat, into someone started talking about it. Copy and paste from discord: Sa1672ndo — 8/28/25, 2:22 PM -Dorg.lwjgl.system.stackSize=256 add this to your JVM args and that should fix it

It did in fact fix it. Hopefully this helps someone in the future.

Spri-Rgb avatar Sep 02 '25 02:09 Spri-Rgb

As of the Nvidia Driver ver 580.82.07, this issue is fixed. Update your systems. Nvidia patch notes: Fixed a bugregression introduced in 580.65.06 that could cause Vulkan applications to hang on Wayland. Added support for NVIDIA Smooth Motion on GeForce RTX 40 Series GPUs. Fixed a bug that caused /sys/class/drm/.../enabled to always report "disabled" for NVIDIA GPU connectors.

firstpuppet avatar Sep 06 '25 03:09 firstpuppet

Having the same issue.

Edit: I went on Vulkan discord and start scrolling up in the Off-topic chat, into someone started talking about it. Copy and paste from discord: Sa1672ndo — 8/28/25, 2:22 PM -Dorg.lwjgl.system.stackSize=256 add this to your JVM args and that should fix it

It did in fact fix it. Hopefully this helps someone in the future.

This is the fix. Thank uu. It really helped someone after 1 week

ahm3tak1f616 avatar Sep 07 '25 17:09 ahm3tak1f616

The same thing happens to me on a 4070, in 1.21.5 and in 1.21.4.

GINEVERI avatar Sep 16 '25 23:09 GINEVERI

As of the Nvidia Driver ver 580.82.07, this issue is fixed. Update your systems. Nvidia patch notes: Fixed a bugregression introduced in 580.65.06 that could cause Vulkan applications to hang on Wayland. Added support for NVIDIA Smooth Motion on GeForce RTX 40 Series GPUs. Fixed a bug that caused /sys/class/drm/.../enabled to always report "disabled" for NVIDIA GPU connectors.

Wayland is linux thing-y, right? This issue happen on windows, so... It doesn't relate to our issue, I think. And no, as of v581 on windows issue is still there.

DivannKokos avatar Sep 19 '25 08:09 DivannKokos

I encountered this problem as well with the 581.29 driver version of my GeForce RTX 40 series GPU, game version 1.21.5. Is there a way to solve this?

bao7-CMD avatar Sep 20 '25 10:09 bao7-CMD

i have the same thing the stack size thingy didnt help it caused error code 1 https://imgur.com/a/WnSCi9e

WhitefangY avatar Sep 20 '25 18:09 WhitefangY

As of the Nvidia Driver ver 580.82.07, this issue is fixed. Update your systems. Nvidia patch notes: Fixed a bugregression introduced in 580.65.06 that could cause Vulkan applications to hang on Wayland. Added support for NVIDIA Smooth Motion on GeForce RTX 40 Series GPUs. Fixed a bug that caused /sys/class/drm/.../enabled to always report "disabled" for NVIDIA GPU connectors.

Wayland is linux thing-y, right? This issue happen on windows, so... It doesn't relate to our issue, I think. And no, as of v581 on windows issue is still there.

Image welp, this stinks

firstpuppet avatar Sep 24 '25 02:09 firstpuppet

i have the same thing the stack size thingy didnt help it caused error code 1 https://imgur.com/a/WnSCi9e

please try with only vulkanmod, i think some other mods could be in turn incompatible with stack size thingy (i'm no developer so i don't know what this stack thingy actually is, but with it my vulkan setup works)

DivannKokos avatar Sep 26 '25 07:09 DivannKokos

i have the same thing the stack size thingy didnt help it caused error code 1 https://imgur.com/a/WnSCi9e

please try with only vulkanmod, i think some other mods could be in turn incompatible with stack size thingy (i'm no developer so i don't know what this stack thingy actually is, but with it my vulkan setup works)

From my testing, vulkanmod has no conflicts with any other mods. I tested this by using Simply Optimized, getting rid of certain mods that cause issues, then disabling and renabling each one to see if they have aconflict.So this is not mod compatiblty issue, for now use -Dorg.lwjgl.system.stackSize=256

firstpuppet avatar Sep 27 '25 01:09 firstpuppet

-Dorg.lwjgl.system.stackSize=256

shouldnt this be mentioned somewhere in a "troubleshooting" section for vulkanmod?

Notenlish avatar Oct 28 '25 11:10 Notenlish

Probably better if it’s just added to the mod description as like a “For NVIDIA users:” Sent from Proton Mail for iOS On Tue, Oct 28, 2025 at 4:35 AM, Notenlish @.> wrote: Notenlish left a comment (xCollateral/VulkanMod#665) -Dorg.lwjgl.system.stackSize=256 shouldnt this be mentioned somewhere in a "troubleshooting" section for vulkanmod? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.>

firstpuppet avatar Oct 30 '25 02:10 firstpuppet

@HoneyBerries This should be closed

Versatile-One avatar Dec 05 '25 13:12 Versatile-One

i have the same thing the stack size thingy didnt help it caused error code 1 https://imgur.com/a/WnSCi9e

please try with only vulkanmod, i think some other mods could be in turn incompatible with stack size thingy (i'm no developer so i don't know what this stack thingy actually is, but with it my vulkan setup works)

i tried and didnt work bro RTX 3050 Refresh Mobile 6GB + GeForce Driver 591.59

Confiac1563 avatar Jan 05 '26 06:01 Confiac1563

@Confiac1563 Send crashlog

Versatile-One avatar Jan 05 '26 14:01 Versatile-One

@Confiac1563 Send crashlog

fixed with -Dorg.lwjgl.system.stackSize=256

Confiac1563 avatar Jan 06 '26 09:01 Confiac1563