Wynntils

Wynntils

611k Downloads

DiscordRichPresence will crash when no valid version of GLIBC is found

atiedebee opened this issue ยท 7 comments

commented
[19:19:42] [Render thread/ERROR]: Failed to initialize Wynntils features
java.lang.UnsatisfiedLinkError: /tmp/java-discord-game-sdk-32228091688074/libdiscord_game_sdk_jni.so: /lib64/libc.so.6: version `GLIBC_2.34' not found (required by /tmp/java-discord-game-sdk-32228091688074/libdiscord_game_sdk_jni.so)

Simply, the discord_game_sdk_jni.so requires version 2.34 of glibc, which is apparently not present on my system. This will crash every time the config is loaded, which includes saving the content book causing other changes not to be saved.

I got a quick workaround working by try-catching the error and disabling the feature, though this is very dirty and I assume a more solution should exist.

The quick and dirty try-catch (DiscordRichPresenceFeature.java:127)

protected void onConfigUpdate(ConfigHolder configHolder) {                                                                                                                                            
         if (this.isEnabled()) {                                                                                                                                                                           
             // This isReady() check is required for Linux to not crash on config change.                                                                                                                  
             if (!Services.Discord.isReady()) {                                                                                                                                                            
                try{                                                                                                                                                                                       
                     // Even though this is in the onConfigUpdate method, it is how the library is first loaded on launch                                                                                  
                     Services.Discord.load(); 
                 }catch(UnsatisfiedLinkError e){                                                                                                                                                           
                     WynntilsMod.getLogger().warn("Failed setting up discord rich presence: {}", e.getMessage());                                                                                          
                     Managers.Feature.disableFeature(this);
                     return; 
                 }                                                                                                                                                                                       
             }                                                                                                                                                                                           

The full backtrace:

[19:19:42] [Render thread/ERROR]: Failed to initialize Wynntils features
java.lang.UnsatisfiedLinkError: /tmp/java-discord-game-sdk-32228091688074/libdiscord_game_sdk_jni.so: /lib64/libc.so.6: version `GLIBC_2.34' not found (required by /tmp/java-discord-game-sdk-32228091688074/libdiscord_game_sdk_jni.so)
	at jdk.internal.loader.NativeLibraries.load(Native Method) ~[?:?]
	at jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:388) ~[?:?]
	at jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:232) ~[?:?]
	at jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:174) ~[?:?]
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:2389) ~[?:?]
	at java.lang.Runtime.load0(Runtime.java:755) ~[?:?]
	at java.lang.System.load(System.java:1953) ~[?:?]
	at com.wynntils.antiope.core.DiscordGameSDKCore.loadLibrary(DiscordGameSDKCore.java:97) ~[wynntils-0.0.3-SNAPSHOT-fabric+MC-1.19.4.jar:?]
	at com.wynntils.services.discord.DiscordService.load(DiscordService.java:35) ~[wynntils-0.0.3-SNAPSHOT-fabric+MC-1.19.4.jar:?]
	at com.wynntils.features.DiscordRichPresenceFeature.onConfigUpdate(DiscordRichPresenceFeature.java:135) ~[wynntils-0.0.3-SNAPSHOT-fabric+MC-1.19.4.jar:?]
	at com.wynntils.core.consumers.features.Feature.updateConfigOption(Feature.java:91) ~[wynntils-0.0.3-SNAPSHOT-fabric+MC-1.19.4.jar:?]
	at com.wynntils.core.config.ConfigHolder.setValue(ConfigHolder.java:142) ~[wynntils-0.0.3-SNAPSHOT-fabric+MC-1.19.4.jar:?]
	at com.wynntils.core.config.ConfigHolder.reset(ConfigHolder.java:169) ~[wynntils-0.0.3-SNAPSHOT-fabric+MC-1.19.4.jar:?]
	at com.wynntils.core.config.ConfigManager.loadConfigOptions(ConfigManager.java:142) ~[wynntils-0.0.3-SNAPSHOT-fabric+MC-1.19.4.jar:?]
	at com.wynntils.core.config.ConfigManager.reloadConfiguration(ConfigManager.java:100) ~[wynntils-0.0.3-SNAPSHOT-fabric+MC-1.19.4.jar:?]
	at com.wynntils.core.config.ConfigManager.init(ConfigManager.java:70) ~[wynntils-0.0.3-SNAPSHOT-fabric+MC-1.19.4.jar:?]
	at com.wynntils.core.WynntilsMod.initFeatures(WynntilsMod.java:234) ~[wynntils-0.0.3-SNAPSHOT-fabric+MC-1.19.4.jar:?]
	at com.wynntils.core.WynntilsMod.onResourcesFinishedLoading(WynntilsMod.java:164) ~[wynntils-0.0.3-SNAPSHOT-fabric+MC-1.19.4.jar:?]
	at net.minecraft.class_6360.handler$bbb000$wynntils$onResourceManagerReloadPost(class_6360.java:520) ~[client-intermediary.jar:?]
	at net.minecraft.class_6360.method_36562(class_6360.java:46) ~[client-intermediary.jar:?]
	at net.minecraft.class_310.method_29338(class_310.java:664) ~[client-intermediary.jar:?]
	at net.minecraft.class_156.method_17974(class_156.java:514) ~[client-intermediary.jar:?]
	at net.minecraft.class_310.method_24040(class_310.java:660) ~[client-intermediary.jar:?]
	at net.minecraft.class_425.method_25394(class_425.java:147) ~[client-intermediary.jar:?]
	at net.minecraft.class_757.method_3192(class_757.java:926) ~[client-intermediary.jar:?]
	at net.minecraft.class_310.method_1523(class_310.java:1218) ~[client-intermediary.jar:?]
	at net.minecraft.class_310.method_1514(class_310.java:801) ~[client-intermediary.jar:?]
	at net.minecraft.client.main.Main.main(Main.java:237) ~[minecraft-1.19.4-client.jar:?]
	at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:468) ~[fabric-loader-0.14.21.jar:?]
	at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74) ~[fabric-loader-0.14.21.jar:?]
	at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23) ~[fabric-loader-0.14.21.jar:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
	at org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:243) ~[NewLaunch.jar:?]
	at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:278) ~[NewLaunch.jar:?]
	at org.multimc.EntryPoint.listen(EntryPoint.java:143) ~[NewLaunch.jar:?]
	at org.multimc.EntryPoint.main(EntryPoint.java:34) ~[NewLaunch.jar:?]
commented

GLIBC not being present in Linux is like not having c++ redistributable on Windows. If we can, we will catch this, but this is not our problem. Most of the time, Debian (Ubuntu, etc) users have this issue since they use such old packages..

commented

I'm on a dated LTS distro, so this is currently an issue for me. I noticed it's related to #1789, since it causes the entire config to be reset.

It would be nice to have a fallback so similar problems won't cause more issues

commented

@DonkeyBlaster can you take a look?

commented

I'm on a dated LTS distro, so this is currently an issue for me. I noticed it's related to #1789, since it causes the entire config to be reset.

It would be nice to have a fallback so similar problems won't cause more issues

Which LTS specifically? I can try to make a vm later to try myself

commented

I'm on a dated LTS distro, so this is currently an issue for me. I noticed it's related to #1789, since it causes the entire config to be reset.
It would be nice to have a fallback so similar problems won't cause more issues

Which LTS specifically? I can try to make a vm later to try myself

ubuntu 20 lts or earlier. Only 22 lts added GLIBC34< support.

commented

Which LTS specifically? I can try to make a vm later to try myself

I'm currently on OpenSUSE LEAP 15.3

commented

My take on this:

  • It is reasonable to catch UnsatisfiedLinkError when we try to load external libs, and at least disable the feature, as in the suggested patch.
  • This can reasonably be accompanied by a error message to the chat about this
  • We should not crash the config system if a onConfigUpdate() throws an exception! :-o This is perhaps the most serious problem of them all...