ImpromptuNinjas / UltralightSharp

Multi-platform .NET bindings to the Ultralight project.
Other
129 stars 17 forks source link

Got SIGSEGV when internal calling ultralight::FontCache::Recycle #14

Closed 0xF6 closed 2 years ago

0xF6 commented 2 years ago

I took the project from Ultra light Sharp.UnityTests, upgraded Unity NuGet, upgraded UltralightSharp to latest version. Disabled Assembly Version Validate in Player setting, and run sample scene after first play - worked, after second got SIGSEGV and crash unity (Press play button, wait, press unplay button, wait and press play again and get crash) Sometimes that crash and from the first launch

Unity Version: 2020.3.33f1 (LTS) UltralightSharp Version: 1.2.0-beta-r11

Log:

Unity Editor Log ``` Initialized touch support. SpriteAtlasPacking completed in 0.014487 sec Reloading assemblies for play mode. Begin MonoManager ReloadAssembly Native extension for WindowsStandalone target not found Refreshing native plugins compatible for Editor in 14.83 ms, found 9 plugins. Preloading 0 native plugins for Editor in 0.00 ms. [MODES] ModeService[none].Initialize [MODES] ModeService[none].LoadModes [MODES] Loading mode Default (0) for mode-current-id-UltralightSharp.UnityTests Mono: successfully reloaded assembly - Completed reload, in 2.882 seconds Domain Reload Profiling: ReloadAssembly (2883ms) BeginReloadAssembly (370ms) ExecutionOrderSort (0ms) DisableScriptedObjects (46ms) BackupInstance (0ms) ReleaseScriptingObjects (0ms) CreateAndSetChildDomain (203ms) EndReloadAssembly (2403ms) LoadAssemblies (172ms) RebuildTransferFunctionScriptingTraits (0ms) SetupTypeCache (491ms) ReleaseScriptCaches (1ms) RebuildScriptCaches (117ms) SetupLoadedEditorAssemblies (527ms) LogAssemblyErrors (0ms) InitializePlatformSupportModulesInManaged (8ms) SetLoadedEditorAssemblies (1ms) RefreshPlugins (15ms) BeforeProcessingInitializeOnLoad (149ms) ProcessInitializeOnLoadAttributes (318ms) ProcessInitializeOnLoadMethodAttributes (23ms) AfterProcessingInitializeOnLoad (12ms) EditorAssembliesLoaded (0ms) ExecutionOrderSort2 (0ms) AwakeInstancesAfterBackupRestoration (520ms) Platform modules already initialized, skipping LightingSettings: switching bake backend from 1 to 0. [Ultralight] [Info] Creating Session with the following configuration: id: 9223372036854775811 is_persistent: 0 name: Demo is_default: 0 disk_path: /Desktop/Ulitralight/UltralightSharp/UltralightSharp.UnityTests/Assets/StreamingAssets\ultralight\cache\Demo (you can adjust this location in Config::cache_path) UnityEngine.StackTraceUtility:ExtractStackTrace () UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[]) UnityEngine.Logger:Log (UnityEngine.LogType,object) UnityEngine.Debug:Log (object) UltralightBrowserDemo:LoggerCallback (ImpromptuNinjas.UltralightSharp.Enums.LogLevel,ImpromptuNinjas.UltralightSharp.String*) (at Assets/UltralightBrowserDemo.cs:234) ImpromptuNinjas.UltralightSharp.Session:Create (ImpromptuNinjas.UltralightSharp.Renderer*,bool,ImpromptuNinjas.UltralightSharp.String*) UltralightBrowserDemo:OnEnable () (at Assets/UltralightBrowserDemo.cs:104) (Filename: Assets/UltralightBrowserDemo.cs Line: 234) [Ultralight] [Info] Creating View with the following configuration: width: 640 height: 480 device scale: 1 session id: 9223372036854775811 UnityEngine.StackTraceUtility:ExtractStackTrace () UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[]) UnityEngine.Logger:Log (UnityEngine.LogType,object) UnityEngine.Debug:Log (object) UltralightBrowserDemo:LoggerCallback (ImpromptuNinjas.UltralightSharp.Enums.LogLevel,ImpromptuNinjas.UltralightSharp.String*) (at Assets/UltralightBrowserDemo.cs:234) ImpromptuNinjas.UltralightSharp.View:Create (ImpromptuNinjas.UltralightSharp.Renderer*,uint,uint,bool,ImpromptuNinjas.UltralightSharp.Session*) UltralightBrowserDemo:OnEnable () (at Assets/UltralightBrowserDemo.cs:106) (Filename: Assets/UltralightBrowserDemo.cs Line: 234) [Ultralight] [Info] Creating View with the following configuration: width: 10 height: 10 device scale: 1 session id: 3 UnityEngine.StackTraceUtility:ExtractStackTrace () UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[]) UnityEngine.Logger:Log (UnityEngine.LogType,object) UnityEngine.Debug:Log (object) UltralightBrowserDemo:LoggerCallback (ImpromptuNinjas.UltralightSharp.Enums.LogLevel,ImpromptuNinjas.UltralightSharp.String*) (at Assets/UltralightBrowserDemo.cs:234) ImpromptuNinjas.UltralightSharp.View:Create (ImpromptuNinjas.UltralightSharp.Renderer*,uint,uint,bool,ImpromptuNinjas.UltralightSharp.Session*) UltralightBrowserDemo:OnEnable () (at Assets/UltralightBrowserDemo.cs:106) (Filename: Assets/UltralightBrowserDemo.cs Line: 234) Loaded scene 'Temp/__Backupscenes/0.backup' Deserialize: 1.408 ms Integration: 74.966 ms Integration of assets: 0.004 ms Thread Wait Time: 0.030 ms Total Operation Time: 76.409 ms Stacktrace: at <0xffffffff> at (wrapper managed-to-native) ImpromptuNinjas.UltralightSharp.Ultralight.Render (ImpromptuNinjas.UltralightSharp.Renderer*) [0x00009] in <08a80845b4b94c04a26e3a02fe9adfae>:0 at UltralightBrowserDemo.OnWillRenderObject () [0x00035] in C:\Users\ls-mi\Desktop\Ulitralight\UltralightSharp\UltralightSharp.UnityTests\Assets\UltralightBrowserDemo.cs:210 at (wrapper runtime-invoke) object.runtime_invoke_void__this__ (object,intptr,intptr,intptr) [0x00020] in <695d1cc93cca45069c528c15c9fdd749>:0 at <0xffffffff> at (wrapper managed-to-native) UnityEditor.EditorGUIUtility.RenderPlayModeViewCamerasInternal_Injected (UnityEngine.RenderTexture,int,UnityEngine.Vector2&,bool,bool) [0x0000c] in <3371b3e2e5754acd87e600e068350da5>:0 at UnityEditor.EditorGUIUtility.RenderPlayModeViewCamerasInternal (UnityEngine.RenderTexture,int,UnityEngine.Vector2,bool,bool) [0x00007] in <3371b3e2e5754acd87e600e068350da5>:0 at UnityEditor.PlayModeView.RenderView (UnityEngine.Vector2,bool) [0x000ea] in <3371b3e2e5754acd87e600e068350da5>:0 at UnityEditor.GameView.OnGUI () [0x002ee] in <3371b3e2e5754acd87e600e068350da5>:0 at UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect,UnityEngine.Rect) [0x00066] in <3371b3e2e5754acd87e600e068350da5>:0 at UnityEditor.DockArea.DrawView (UnityEngine.Rect,UnityEngine.Rect) [0x00004] in <3371b3e2e5754acd87e600e068350da5>:0 at UnityEditor.DockArea.OldOnGUI () [0x0019d] in <3371b3e2e5754acd87e600e068350da5>:0 at UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event,UnityEngine.Matrix4x4,UnityEngine.Rect,bool,UnityEngine.Rect,System.Action,bool) [0x001e1] in :0 at UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event,UnityEngine.Matrix4x4,UnityEngine.Rect,System.Action,bool) [0x000c8] in :0 at UnityEngine.UIElements.IMGUIContainer.DoIMGUIRepaint () [0x0005a] in :0 at UnityEngine.UIElements.UIR.RenderChainCommand.ExecuteNonDrawMesh (UnityEngine.UIElements.UIR.DrawParams,single,System.Exception&) [0x000c3] in :0 at UnityEngine.UIElements.UIR.UIRenderDevice.EvaluateChain (UnityEngine.UIElements.UIR.RenderChainCommand,UnityEngine.Material,UnityEngine.Material,UnityEngine.Texture,UnityEngine.Texture,UnityEngine.Texture,single,Unity.Collections.NativeSlice`1,Unity.Collections.NativeSlice`1,UnityEngine.MaterialPropertyBlock,bool,System.Exception&) [0x00536] in :0 at UnityEngine.UIElements.UIR.RenderChain.Render () [0x0011f] in :0 at UnityEngine.UIElements.UIRRepaintUpdater.Update () [0x0006c] in :0 at UnityEngine.UIElements.VisualTreeUpdater.UpdateVisualTreePhase (UnityEngine.UIElements.VisualTreeUpdatePhase) [0x0001f] in :0 at UnityEngine.UIElements.Panel.UpdateForRepaint () [0x0003c] in :0 at UnityEngine.UIElements.Panel.Repaint (UnityEngine.Event) [0x00099] in :0 at UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel) [0x00029] in :0 at UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (int,intptr,bool&) [0x0003f] in :0 at UnityEngine.UIElements.UIEventRegistration.ProcessEvent (int,intptr) [0x0001f] in :0 at UnityEngine.UIElements.UIEventRegistration/<>c.<.cctor>b__1_2 (int,intptr) [0x00003] in :0 at UnityEngine.GUIUtility.ProcessEvent (int,intptr,bool&) [0x00018] in :0 at (wrapper runtime-invoke) .runtime_invoke_void_int_intptr_intptr& (object,intptr,intptr,intptr) [0x0002d] in :0 ================================================================= Got a SIGSEGV while executing native code. This usually indicates a fatal error in the mono runtime or one of the native libraries used by your application. ================================================================= Received signal SIGSEGV Stack trace: 0x00007ffb23eade65 (UltralightCore) ultralight::FontCache::Recycle 0x00007ffb23e941f2 (UltralightCore) ultralight::FontCache::Recycle 0x00007ffb78eb0851 (Ultralight) ultralight::Painter::Painter 0x00007ffb78ea6e0b (Ultralight) ulRender 0x000001e12d899457 (Mono JIT Code) (wrapper managed-to-native) ImpromptuNinjas.UltralightSharp.Ultralight:Render (ImpromptuNinjas.UltralightSharp.Renderer*) 0x000001e12d898c6b (Mono JIT Code) [UltralightBrowserDemo.cs:212] UltralightBrowserDemo:OnWillRenderObject () 0x000001e12e6e8890 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr) 0x00007ffb2175f1e0 (mono-2.0-bdwgc) [mini-runtime.c:2849] mono_jit_runtime_invoke 0x00007ffb216e2ac2 (mono-2.0-bdwgc) [object.c:2921] do_runtime_invoke 0x00007ffb216ebb1f (mono-2.0-bdwgc) [object.c:2968] mono_runtime_invoke 0x00007ff606a139c4 (Unity) scripting_method_invoke 0x00007ff606a0eb81 (Unity) ScriptingInvocation::Invoke 0x00007ff6069e0c1b (Unity) MonoBehaviour::HandleNotifications 0x00007ff606438dc3 (Unity) GameObject::SendMessageAny 0x00007ff6064fa1f2 (Unity) CullSendEvents 0x00007ff6064f9f2d (Unity) CullScene 0x00007ff6064d5627 (Unity) Camera::CustomCull 0x00007ff6064e2b3d (Unity) RenderManager::RenderCameras 0x00007ff6072a1412 (Unity) RepaintController::RenderPlayModeViewCameras 0x00007ff6077ae34e (Unity) EditorGUIUtility::RenderPlayModeViewCamerasInternal 0x00007ff607dca139 (Unity) EditorGUIUtility_CUSTOM_RenderPlayModeViewCamerasInternal_Injected 0x000001e12d897797 (Mono JIT Code) (wrapper managed-to-native) UnityEditor.EditorGUIUtility:RenderPlayModeViewCamerasInternal_Injected (UnityEngine.RenderTexture,int,UnityEngine.Vector2&,bool,bool) 0x000001e12d8976d3 (Mono JIT Code) UnityEditor.EditorGUIUtility:RenderPlayModeViewCamerasInternal (UnityEngine.RenderTexture,int,UnityEngine.Vector2,bool,bool) 0x000001e12d89627b (Mono JIT Code) UnityEditor.PlayModeView:RenderView (UnityEngine.Vector2,bool) 0x000001e126eb53c3 (Mono JIT Code) UnityEditor.GameView:OnGUI () 0x000001e126eb2063 (Mono JIT Code) UnityEditor.HostView:InvokeOnGUI (UnityEngine.Rect,UnityEngine.Rect) 0x000001e126eb1e13 (Mono JIT Code) UnityEditor.DockArea:DrawView (UnityEngine.Rect,UnityEngine.Rect) 0x000001e126ea4a73 (Mono JIT Code) UnityEditor.DockArea:OldOnGUI () 0x000001e126b49650 (Mono JIT Code) UnityEngine.UIElements.IMGUIContainer:DoOnGUI (UnityEngine.Event,UnityEngine.Matrix4x4,UnityEngine.Rect,bool,UnityEngine.Rect,System.Action,bool) 0x000001e126b4891b (Mono JIT Code) UnityEngine.UIElements.IMGUIContainer:HandleIMGUIEvent (UnityEngine.Event,UnityEngine.Matrix4x4,UnityEngine.Rect,System.Action,bool) 0x000001e127fc9e83 (Mono JIT Code) UnityEngine.UIElements.IMGUIContainer:DoIMGUIRepaint () 0x000001e127fc73ab (Mono JIT Code) UnityEngine.UIElements.UIR.RenderChainCommand:ExecuteNonDrawMesh (UnityEngine.UIElements.UIR.DrawParams,single,System.Exception&) 0x000001e127fc587b (Mono JIT Code) UnityEngine.UIElements.UIR.UIRenderDevice:EvaluateChain (UnityEngine.UIElements.UIR.RenderChainCommand,UnityEngine.Material,UnityEngine.Material,UnityEngine.Texture,UnityEngine.Texture,UnityEngine.Texture,single,Unity.Collections.NativeSlice`1,Unity.Collections.NativeSlice`1,UnityEngine.MaterialPropertyBlock,bool,System.Exception&) 0x000001e127fc0893 (Mono JIT Code) UnityEngine.UIElements.UIR.RenderChain:Render () 0x000001e126f4e3c3 (Mono JIT Code) UnityEngine.UIElements.UIRRepaintUpdater:Update () 0x000001e126b27bde (Mono JIT Code) UnityEngine.UIElements.VisualTreeUpdater:UpdateVisualTreePhase (UnityEngine.UIElements.VisualTreeUpdatePhase) 0x000001e126f4db9b (Mono JIT Code) UnityEngine.UIElements.Panel:UpdateForRepaint () 0x000001e126f4d803 (Mono JIT Code) UnityEngine.UIElements.Panel:Repaint (UnityEngine.Event) 0x000001e126b274a7 (Mono JIT Code) UnityEngine.UIElements.UIElementsUtility:DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel) 0x000001e126b271fb (Mono JIT Code) UnityEngine.UIElements.UIElementsUtility:UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (int,intptr,bool&) 0x000001e126b26fff (Mono JIT Code) UnityEngine.UIElements.UIEventRegistration:ProcessEvent (int,intptr) 0x000001e126b26f3b (Mono JIT Code) UnityEngine.UIElements.UIEventRegistration/<>c:<.cctor>b__1_2 (int,intptr) 0x000001e126b26d9d (Mono JIT Code) UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) 0x000001e126b26e4e (Mono JIT Code) (wrapper runtime-invoke) :runtime_invoke_void_int_intptr_intptr& (object,intptr,intptr,intptr) 0x00007ffb2175f1e0 (mono-2.0-bdwgc) [mini-runtime.c:2849] mono_jit_runtime_invoke 0x00007ffb216e2ac2 (mono-2.0-bdwgc) [object.c:2921] do_runtime_invoke 0x00007ffb216ebb1f (mono-2.0-bdwgc) [object.c:2968] mono_runtime_invoke 0x00007ff606a139c4 (Unity) scripting_method_invoke 0x00007ff606a0eb81 (Unity) ScriptingInvocation::Invoke 0x00007ff606a087f5 (Unity) ScriptingInvocation::Invoke 0x00007ff605ccb4ca (Unity) Scripting::UnityEngine::GUIUtilityProxy::ProcessEvent 0x00007ff607334d16 (Unity) GUIView::ProcessRetainedMode 0x00007ff6078a0202 (Unity) GUIView::OnInputEvent 0x00007ff607334c08 (Unity) GUIView::ProcessInputEvent 0x00007ff6078992d2 (Unity) GUIView::DoPaint 0x00007ff6078a2e8d (Unity) GUIView::RepaintAll 0x00007ff607402077 (Unity) PlayerLoopController::UpdateScene 0x00007ff6073ed5f2 (Unity) PlayerLoopController::EnterPlayMode 0x00007ff6073fd5d0 (Unity) PlayerLoopController::SetIsPlaying 0x00007ff607400317 (Unity) Application::TickTimer 0x00007ff60786f201 (Unity) MainMessageLoop 0x00007ff6078733a1 (Unity) WinMain 0x00007ff608f15f3e (Unity) __scrt_common_main_seh 0x00007ffbb76b244d (KERNEL32) BaseThreadInitThunk 0x00007ffbb86edf88 (ntdll) RtlUserThreadStart ```
SupinePandora43 commented 2 years ago

Unity editor launches code in same process. Ultralight's renderer can only be created once per process lifetime.