NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.19k stars 14.2k forks source link

unityhub, Attempt to free invalid pointer #275213

Open soupglasses opened 11 months ago

soupglasses commented 11 months ago

Describe the bug

A clear and concise description of what the bug is.

Running directly through unityhub ``` (Unity:11807): Gtk-CRITICAL **: 16:29:53.599: gtk_container_foreach: assertion 'GTK_IS_CONTAINER (container)' failed ``` ``` Unable to load player prefs ``` ``` ../../third_party/tcmalloc/chromium/src/tcmalloc.cc:289] Attempt to free invalid pointer 0x564dc9d7c5a0 ```
Running with steam-run: ``` Process terminated. Couldn't find a valid ICU package installed on the system. Set the configuration flag System.Globalization.Invariant to true if you want to run with no globalization support. at System.Environment.FailFast(System.String) at System.Globalization.GlobalizationMode.GetGlobalizationInvariantMode() at System.Globalization.GlobalizationMode..cctor() at System.Globalization.CultureData.CreateCultureWithInvariantData() at System.Globalization.CultureData.get_Invariant() at System.Globalization.CultureInfo..cctor() at System.String.ToLowerInvariant() at System.Text.EncodingHelper.GetCharset() at System.Text.EncodingHelper.GetEncodingFromCharset() at System.ConsolePal.GetConsoleEncoding() at System.Console+<>c.b__19_0() at System.Threading.LazyInitializer.EnsureInitializedCore[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef, System.Object ByRef, System.Func`1) at System.Threading.LazyInitializer.EnsureInitialized[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef, System.Object ByRef, System.Func`1) at System.Console.get_OutputEncoding() at System.Console.CreateOutputWriter(System.IO.Stream) at System.Console+<>c.b__26_0() at System.Threading.LazyInitializer.EnsureInitializedCore[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef, System.Object ByRef, System.Func`1) at System.Threading.LazyInitializer.EnsureInitialized[[System.__Canon, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef, System.Object ByRef, System.Func`1) at System.Console.get_Out() at Unity.Licensing.Client.Program.Main(System.String[]) ```

Steps To Reproduce

Steps to reproduce the behavior:

  1. Install 2019.31 with Linux, Windows and Android support.
  2. Create a new Core 3D project.
  3. See above error in ~/.config/unity3d/Editor.log

Expected behavior

A clear and concise description of what you expected to happen.

Unity launches

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.

Notify maintainers

@tesq0 @huantianad

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

Latest nixos unstable: a9bf124c46ef298113270b1f84a164865987a91c

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
output here

Add a :+1: reaction to issues you find important.

soupglasses commented 11 months ago

Running unity with steam-run does not help.

soupglasses commented 11 months ago

Another bug, might be the actual issue.

(Unity:11807): Gtk-CRITICAL **: 16:29:53.599: gtk_container_foreach: assertion 'GTK_IS_CONTAINER (container)' failed
Unable to load player prefs
../../third_party/tcmalloc/chromium/src/tcmalloc.cc:289] Attempt to free invalid pointer 0x564dc9d7c5a0 

May be related from my radeon card?

soupglasses commented 11 months ago

Looks very similar as #271483, as this worked a month ago, but recently has stopped working completely for me.

soupglasses commented 11 months ago

Yup. Running LD_PRELOAD=/nix/store/hbqq0way8sy1z4zd1h5nvmmv1v2cxfp1-gperftools-2.10/lib/libtcmalloc_minimal.so:$LD_PRELOAD unityhub fixes the issue.

huantianad commented 11 months ago

Can we fix the issue by adding the package to the FHS env? Is that something we should do?

soupglasses commented 11 months ago

Hit a new fun errors when attempting to do some work. Unsure if this is a one off or not.

AssetDatabase: script compilation time: 0.023423s
Caught fatal signal - signo:11 code:1 errno:0 addr:0xffffffffffffffe8
Obtained 16 stack frames.
#0  0x0055bcc3620545 in burst_signal_handler(int, siginfo_t*, void*)
#1  0x007f5f6ae55a70 in __sigaction
#2  0x0055bcc1647a00 in AssetImporter::GetAssetPathName() const
#3  0x0055bcc2ab82be in AssetImporter_Get_Custom_PropAssetPath(ScriptingBackendNativeObjectPtrOpaque*)
#4  0x000000422bec8a in (wrapper managed-to-native) UnityEditor.AssetImporter:get_assetPath (UnityEditor.AssetImporter)
#5  0x000000422bead7 in (wrapper runtime-invoke) <Module>:runtime_invoke_bool__this__ (object,intptr,intptr,intptr)
#6  0x007f5e4665b7d7 in mono_print_method_from_ip
#7  0x007f5e467cb3a0 in mono_perfcounter_foreach
#8  0x007f5e467cc24d in mono_runtime_invoke
#9  0x0055bcc3d61413 in scripting_method_invoke(ScriptingMethodPtr, ScriptingObjectPtr, ScriptingArguments&, ScriptingExceptionPtr*, bool)
#10 0x0055bcc3d5b626 in ScriptingInvocation::Invoke(ScriptingExceptionPtr*, bool)
#11 0x0055bcc3d5b2fc in bool ScriptingInvocation::Invoke<bool>(ScriptingExceptionPtr*, bool)
#12 0x0055bcc097f7f9 in Scripting::UnityEditor::PluginImporterProxy::InvokeShouldOverridePredicate(ScriptingExceptionPtr*)
#13 0x0055bcc1e1e42c in IsAssemblyCompatible(TargetAssemblyInfo const&, core::basic_string<char, core::StringStorageDefault<char> >&, BuildTargetPlatformGroup, BuildTargetPlatform, bool, bool, std::map<core::basic_string<char, core::StringStorageDefault<char> >, core::basic_string<char, core::StringStorageDefault<char> >, std::less<core::basic_string<char, core::StringStorageDefault<char> > >, std::allocator<std::pair<core::basic_string<char, core::StringStorageDefault<char> > const, core::basic_string<char, core::StringStorageDefault<char> > > > >&)
#14 0x0055bcc1e253a6 in GetPrecompiledAssembliesManaged(bool, BuildTargetPlatformGroup, BuildTargetPlatform)
#15 0x00000041639d7b in (wrapper managed-to-native) UnityEditor.Scripting.ScriptCompilation.PrecompiledAssemblyProvider:GetPrecompiledAssembliesInternal (bool,UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget)
Launching bug reporter
This application failed to start because it could not find or load the Qt platform plugin "xcb"
in "".

Available platform plugins are: xcb.

Reinstalling the application may fix this problem.
soupglasses commented 11 months ago

Can we fix the issue by adding the package to the FHS env? Is that something we should do?

I tried adding it as a extraLibs override, but it seemed to have no effect. Forcing it at the terminal helped.

soupglasses commented 11 months ago

Aside, but there seems to also some missing fonts, im guessing Arial or something similar issn't getting substituted. Unsure how to help that besides chucking the MS fonts at this.

huantianad commented 11 months ago

Supporting Unity 2019 in general is always tricky, as I believe by this point it is EOL, and thus lacks a lot of the necessary changes and updates included in newer Unity versions to be more compatible with modern Linux systems, at least in my limited experience.

It seems that in order to fix the invalid pointer issue, we do need to add the mentioned package specifically to LD_PRELOAD. This can be done in the main unityhub package, but I'm not sure if this can cause any other issues with newer versions. I haven't seen any alternative solutions though, but perhaps there are?

Looking at your crash log, nothing stands out to me immediately. Are you attempting to open an existing project? If so, could you try with a blank project, just to check if this is a project specific issue.

I personally haven't hit anything with missing fonts, but I don't think it's super feasible to include the MS fonts package alongside unityhub automatically. This could be another thing fixed in newer unity versions too perhaps

soupglasses commented 11 months ago

The error seemed to only happen once or maybe twice, restarting Unity got past the crash.

The font rendering issue was specifically with VRChat's upload stage, which runs as a game inside the Unity player. All UI elements in Unity seem fine, besides some black windows that pop up occasionally, not sure what they are, but they never stopped me using Unity.

huantianad commented 10 months ago

Ok, we can ignore that crash for now.

If the font rendering issue is in the player, I feel like that might be something that needs to be fixed in the game itself.

I'm not sure if we should edit the unityhub package to include the workaround, #271483 still hasn't been closed with a fix to the steam derivation, so perhaps we should continue to wait to see how they resolve this.