Sodium

Sodium

44M Downloads

Sodium seems to crash the game when loading with environment variable "mesa_glthread=true"

moxvallix opened this issue ยท 13 comments

commented

Version information

sodium-fabric-mc1.18-0.4.0-alpha5+build.9

Reproduction Steps

  1. Make sure you are using Mesa drivers on an Intel chip. (On Arch Linux, latest kernel)
  2. Launch the game (Minecraft 1.18) with the environment variable env mesa_glthread=true set. (Using MultiMC Launcher)
  3. Load up a world.
  4. Play normally for up to a minute, then the game will freeze for approximately 7 seconds, before crashing.

Crash Report file

This is an error log generated from one of the times the game crashed whilst I was testing for this bug report. Strangely, these log files weren't consistently generated with the crashes.
hs_err_pid4697.log

This next log was outputted into my system journal when the crash occurred.
systemd.log

This is the full log from MultiMC, from one of my tests, starting Minecraft right up until the crash. Other mods show up at the start of the log, but they were disabled for while I was testing this.
multimc.log

Additional information

My Machine:
Lenovo ThinkPad P15s Gen 2
CPU: 11th Gen Intel i7-1165G7 (8) @ 4.700GHz
GPU: Intel TigerLake-LP GT2 [Iris Xe Graphics] & NVIDIA Quadro T500 Mobile (Optimus setup)
RAM: 16GB
Running Arch Linux kernel 5.15.6-arch2-1, with KDE Plasma desktop.

I tested four combinations:

  1. Fabric loader, all mods disabled.
  2. Fabric loader, all mods disabled, env mesa_glthread=true.
  3. Fabric loader, sodium enabled.
  4. Fabric loader, sodium enabled, env mesa_glthread=true.

The crash only ocurred with the fourth combination.

Sodium (at least the 1.18 alpha, haven't tested others) is seemingly incompatible with this Mesa option. While it is easy to just remove that variable from my wrapper command in MultiMC, it seems like this is going to be set as a default for Linux Minecraft players using Mesa drivers. Attached is the article where I found out about this setting. https://www.gamingonlinux.com/2021/12/minecraft-30-percent-faster-on-linux-with-mesa-drivers/.

It's also possible that this is just an issue with my machine in particular, it has been causing all kinds of graphical pain in the last few days (I had troubles with Intel graphics on the last version of the kernel, and am still working on my Nvidia drivers). If needed, I can also test this out on my old laptop, however, it has much older hardware and may not experience this issue.

commented

Here is the link to the issue I have opened, just in case you want to check it out. I will post updates from it to here as well.
https://gitlab.freedesktop.org/mesa/mesa/-/issues/5719

commented

If the mesa drivers will be turning this setting on for Minecraft by default

Mesa driver is enabling mesa_glthread=true by default for Minecraft now, and I understand it will only work with the official Minecraft launcher..

commented

Mesa driver is enabling mesa_glthread=true by default for Minecraft now, and I understand it will only work with the official Minecraft launcher..

Yeah it will only work with the official launcher. Unfortunately that is the launcher most people use, and thus will likely encounter this crash if they are using Sodium, and are using Mesa drivers.

commented

Another thing I feel I should mention: I managed to play the game normally for quite a while with this setting set, until it crashed after about 30 minutes of play. It then started its crashing every minute behaviour after that. Im gonna assume this was my computer being weird, but felt that it might maybe be useful?

commented

Regrettably we've had a lot of reports that the mesa_glthread option causes random crashes with Sodium installed, especially since articles have circulated claiming it will improve Minecraft's performance. I think there's a problem in the Mesa somewhere outside our control... and we don't really have any leads as to what that could be.

commented

If the mesa drivers will be turning this setting on for Minecraft by default, maybe there's a way that people can be warned when starting sodium with this setting enabled? It seems as long as people use the normal minecraft launcher, this variable will be set without them even knowing.

If this is a problem in mesa, should I take this bug report instead to freedesktop.org? Seems like this is a fairly important issue to get fixed.

commented

I'm not sure how we can detect if mesa_glthread is enabled outside of checking the Mesa version and environment variables... but that wouldn't insulate us from distros changing the defaults.

Firefox looks like it forcefully disables it via environment variables but it's not straightforward to do from Java even if you can apparently reflect-hack into it like everything else.

As for making a bug report on freedesktop.org, feel free to do so! I don't have much to contribute at this time that would be helpful for their developers, but who knows, maybe someone over there wouldn't mind looking into this.

commented

Alright, when I have some time I'll open an issue on their Gitlab, and link to it here.

commented

solved from gitlab

commented

This issue has been solved by this commit. I just compiled the latest git of mesa and can confirm that it fixed the issue.

commented

We'll close this since it appears to be solved in Mesa. The 22.0 release looks like it's out by ~3 or so weeks but hopefully once it lands it will contain a fix for this problem.

commented

Mesa 22.0 has been released, and per the release notes...

Bug fixes:
...
Setting mesa_glthread to true crashes Minecraft when Sodium optimisation mod is enabled.

commented

happens again

i dont know if this is glthread again but it freezes everything