Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I cant play midi #2563

Closed
Nuxssss opened this issue Feb 20, 2022 · 9 comments
Closed

I cant play midi #2563

Nuxssss opened this issue Feb 20, 2022 · 9 comments
Labels
Area: Audio Issue: Bug This issue is a bug report. Platform: Linux Things that relate to Linux explicitly.

Comments

@Nuxssss
Copy link

Nuxssss commented Feb 20, 2022

[ERRO] runtime: Caught exception in "Async Queued Callback"
System.DllNotFoundException: Unable to load shared library '/home/nuxs/ss13/bin/loader/libswnfd.so' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: /usr/lib/libbz2.so.1.0: undefined symbol: BZ2_hbMakeCodeLengths
at System.Runtime.InteropServices.NativeLibrary.LoadFromPath(String libraryName, Boolean throwOnError)
at SS14.Loader.Program.LoadContextOnResolvingUnmanaged(Assembly assembly, String unmanaged) in /home/runner/work/SS14.Launcher/SS14.Launcher/SS14.Loader/Program.cs:line 39
at System.Runtime.Loader.AssemblyLoadContext.GetResolvedUnmanagedDll(Assembly assembly, String unmanagedDllName)
at System.Runtime.Loader.AssemblyLoadContext.ResolveUnmanagedDllUsingEvent(String unmanagedDllName, Assembly assembly, IntPtr gchManagedAssemblyLoadContext)
at System.Runtime.InteropServices.NativeLibrary.LoadByName(String libraryName, QCallAssembly callingAssembly, Boolean hasDllImportSearchPathFlag, UInt32 dllImportSearchPathFlag, Boolean throwOnError)
at System.Runtime.InteropServices.NativeLibrary.LoadLibraryByName(String libraryName, Assembly assembly, Nullable1 searchPath, Boolean throwOnError) at System.Runtime.InteropServices.NativeLibrary.Load(String libraryName, Assembly assembly, Nullable1 searchPath)
at Robust.Client.Utility.ClientDllMap.<>c.b__0_0(String name, Assembly assembly, Nullable1 path) in /home/runner/work/RobustToolbox/RobustToolbox/Robust.Client/Utility/ClientDllMap.cs:line 20 at System.Runtime.InteropServices.NativeLibrary.LoadLibraryCallbackStub(String libraryName, Assembly assembly, Boolean hasDllImportSearchPathFlags, UInt32 dllImportSearchPathFlags) at Robust.Client.UserInterface.FileDialogManager.sw_NFD_OpenDialog(Byte* filterList, Byte* defaultPath, Byte** outPath) at Robust.Client.UserInterface.FileDialogManager.<>c__DisplayClass8_0.<OpenFileNfd>b__0() in /home/runner/work/RobustToolbox/RobustToolbox/Robust.Client/UserInterface/FileDialogManager.cs:line 95 at Robust.Client.UserInterface.FileDialogManager.<>c__DisplayClass11_0.<RunAsyncMaybe>b__0() in /home/runner/work/RobustToolbox/RobustToolbox/Robust.Client/UserInterface/FileDialogManager.cs:line 188 at System.Threading.Tasks.Task1.InnerInvoke()
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
at Robust.Client.UserInterface.FileDialogManager.GetOpenFileName(FileDialogFilters filters) in /home/runner/work/RobustToolbox/RobustToolbox/Robust.Client/UserInterface/FileDialogManager.cs:line 51
at Robust.Client.UserInterface.FileDialogManager.OpenFile(FileDialogFilters filters) in /home/runner/work/RobustToolbox/RobustToolbox/Robust.Client/UserInterface/FileDialogManager.cs:line 35
at Content.Client.Instruments.UI.InstrumentMenu.MidiFileButtonOnOnPressed(ButtonEventArgs obj) in /home/runner/work/space-station-14/space-station-14/Content.Client/Instruments/UI/InstrumentMenu.xaml.cs:line 80
at System.Threading.Tasks.Task.<>c.b__127_0(Object state)
at Robust.Shared.Asynchronous.RobustSynchronizationContext.ProcessPendingTasks() in /home/runner/work/RobustToolbox/RobustToolbox/Robust.Shared/Asynchronous/RobustSynchronizationContext.cs:line 57

@DubiousDoggo
Copy link

Could you give a bit more info on this?
Steps to reproduce?
What OS are you running?

@Zumorica

This comment was marked as resolved.

@PJB3005
Copy link
Member

PJB3005 commented Feb 24, 2022

The problem seems to be in bzip2 or something, which we don't even have as a direct dependency. Can you run something like lddtree on /home/nuxs/ss13/bin/loader/libswnfd.so?

@PJB3005
Copy link
Member

PJB3005 commented Feb 24, 2022

I am also seconding that I am gonna need information on your Linux distro/version at the very least.

@Acruid Acruid added Area: Audio Issue: Bug This issue is a bug report. labels Feb 25, 2022
@PJB3005
Copy link
Member

PJB3005 commented Feb 26, 2022

For some reason (and god this has been a rabbit hole to debug), initializing ALSA (which FluidSynth does when the SS14 instrument menu opens) causes bzip2 to unload from the process.... I'm investigating further and as part of giving up am basically gonna send what I've found to the arch mailing list hoping somebody there is smart enough to figure this crap out.

@PJB3005 PJB3005 added the Platform: Linux Things that relate to Linux explicitly. label Feb 26, 2022
@PJB3005
Copy link
Member

PJB3005 commented Feb 26, 2022

I cannot believe I am saying this but it appears to be a bug in glibc 2.35 (which released at the start of February). The changelog mention a new dependency resolver algorithm, and if you disable it via GLIBC_TUNABLES=glibc.rtld.dynamic_sort=1, the bug goes away. I also made a tiny test program that replicates this:

#include <dlfcn.h>
#include <stdio.h>
#include <unistd.h>

void main()
{
    printf("honk!\n");
    void* lib;

    lib = dlopen("libfreetype.so.6", RTLD_NOW);
    printf("freetype: %llX\n", lib);

    lib = dlopen("libfluidsynth.so.3", RTLD_NOW);
    printf("fluidsynth: %llX\n", lib);

    // Using dlsym so we don't link directly against fluidsynth and it's dynamically loaded.
    // Function signature matches pretty much.
    void* (*new_fluid_settings_fp)() = dlsym(lib, "new_fluid_settings");

    // Yes, fluidsynth initializes all audio drivers by just CREATING the settings. 
    // Meaning we literally can't stop it from initializing ALSA/PortAudio as a quick workaround.
    void* settings = new_fluid_settings_fp();

    printf("Initialized fluidsynth!\n");

    // GTK3 will fail to load if loaded after fluidsynth initialized.
    lib = dlopen("libgtk-3.so", RTLD_NOW);
    printf("GTK3: %llX\n", lib);

    return;
}

Vera also confirmed this tunable fixes the problem she was having where her client was unable to start consistently.

@PJB3005
Copy link
Member

PJB3005 commented Feb 26, 2022

https://bugs.archlinux.org/task/73967 bug filed with arch linux, I'll file it with glibc as soon as they inevitably tell me it's an upstream issue.

@PJB3005
Copy link
Member

PJB3005 commented Mar 11, 2022

Another user report on the steam forums this time: https://steamcommunity.com/app/1482520/discussions/0/5561388294329160548/?tscn=1647015094

PJB3005 added a commit to space-wizards/SS14.Launcher that referenced this issue Mar 14, 2022
Set glibc.rtld.dynamic_sort=1 to work around space-wizards/RobustToolbox#2563
@PJB3005
Copy link
Member

PJB3005 commented Mar 15, 2022

Latest version of the launcher specifies the glibc tunable now, so this should no longer happen.

@PJB3005 PJB3005 closed this as completed Mar 15, 2022
PJB3005 added a commit to space-wizards/SS14.Launcher that referenced this issue Sep 7, 2024
I'm going to assume nobody is using an affected version of glibc anymore, 2 years later.

space-wizards/RobustToolbox#2563
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Audio Issue: Bug This issue is a bug report. Platform: Linux Things that relate to Linux explicitly.
Projects
None yet
Development

No branches or pull requests

5 participants