question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Exception in render loop when using more than one window

See original GitHub issue

Affected c575283 While using DevTools to debug an application, when I navigate the spec tree, the following exceptions are randomly thrown in the render loop.

If I don’t use devtools and there is only one window the problem doesn’t occur.

I ran simulations with ControlCatalog.NetCore OS Windows 10 build 2004 64 bit These are the stack traces:

 Exception in render loop: 'Avalonia.OpenGL.OpenGlException: eglCreatePbufferFromClientBuffer failed with error EGL_BAD_PARAMETER (0x300C)
   at Avalonia.OpenGL.Egl.EglPlatformOpenGlInterface.CreatePBufferFromClientBuffer(Int32 bufferType, IntPtr handle, Int32[] attribs) in C:\GitHub\Avalonia\src\Avalonia.OpenGL\Egl\EglPlatformOpenGlInterface.cs:line 67
   at Avalonia.OpenGL.Angle.AngleWin32EglDisplay.WrapDirect3D11Texture(EglPlatformOpenGlInterface egl, IntPtr handle, Int32 offsetX, Int32 offsetY, Int32 width, Int32 height) in C:\GitHub\Avalonia\src\Avalonia.OpenGL\Angle\AngleWin32EglDisplay.cs:line 92
   at Avalonia.Win32.CompositionEglGlPlatformSurface.CompositionRenderTarget.BeginDraw() in C:\GitHub\Avalonia\src\Windows\Avalonia.Win32\Composition\CompositionEglGlPlatformSurface.cs:line 88
   at Avalonia.Skia.GlRenderTarget.BeginRenderingSession() in C:\GitHub\Avalonia\src\Skia\Avalonia.Skia\Gpu\OpenGl\GlRenderTarget.cs:line 63
   at Avalonia.Skia.SkiaGpuRenderTarget.CreateDrawingContext(IVisualBrushRenderer visualBrushRenderer) in C:\GitHub\Avalonia\src\Skia\Avalonia.Skia\Gpu\SkiaGpuRenderTarget.cs:line 27
   at Avalonia.Rendering.DeferredRenderer.EnsureDrawingContext(IDrawingContextImpl& context) in C:\GitHub\Avalonia\src\Avalonia.Visuals\Rendering\DeferredRenderer.cs:line 553
   at Avalonia.Rendering.DeferredRenderer.UpdateRenderLayersAndConsumeSceneIfNeeded(IDrawingContextImpl& context, Boolean recursiveCall) in C:\GitHub\Avalonia\src\Avalonia.Visuals\Rendering\DeferredRenderer.cs:line 310
   at Avalonia.Rendering.DeferredRenderer.Render(Boolean forceComposite) in C:\GitHub\Avalonia\src\Avalonia.Visuals\Rendering\DeferredRenderer.cs:line 266
   at Avalonia.Rendering.DeferredRenderer.Avalonia.Rendering.IRenderLoopTask.Render() in C:\GitHub\Avalonia\src\Avalonia.Visuals\Rendering\DeferredRenderer.cs:line 220
   at Avalonia.Rendering.RenderLoop.TimerTick(TimeSpan time) in C:\GitHub\Avalonia\src\Avalonia.Visuals\Rendering\RenderLoop.cs:line 147' (RenderLoop #66629781)
System.AccessViolationException
  HResult=0x80004003
  Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
  Source=<Cannot evaluate the exception source>
  StackTrace:
<Cannot evaluate the exception stack trace>
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
   at ABI.Windows.UI.Composition.Interop.ICompositionDrawingSurfaceInterop.BeginDraw(IntPtr updateRect, Guid& iid, IntPtr& updateObject, POINT& point) in C:\GitHub\Avalonia\src\Windows\Avalonia.Win32\Composition\ICompositionDrawingSurfaceInterop.cs:line 123
   at Avalonia.Win32.CompositionEglGlPlatformSurface.CompositionRenderTarget.BeginDraw() in C:\GitHub\Avalonia\src\Windows\Avalonia.Win32\Composition\CompositionEglGlPlatformSurface.cs:line 83
   at Avalonia.Skia.GlRenderTarget.BeginRenderingSession() in C:\GitHub\Avalonia\src\Skia\Avalonia.Skia\Gpu\OpenGl\GlRenderTarget.cs:line 63
   at Avalonia.Skia.SkiaGpuRenderTarget.CreateDrawingContext(IVisualBrushRenderer visualBrushRenderer) in C:\GitHub\Avalonia\src\Skia\Avalonia.Skia\Gpu\SkiaGpuRenderTarget.cs:line 27
   at Avalonia.Rendering.DeferredRenderer.EnsureDrawingContext(IDrawingContextImpl& context) in C:\GitHub\Avalonia\src\Avalonia.Visuals\Rendering\DeferredRenderer.cs:line 553
   at Avalonia.Rendering.DeferredRenderer.UpdateRenderLayersAndConsumeSceneIfNeeded(IDrawingContextImpl& context, Boolean recursiveCall) in C:\GitHub\Avalonia\src\Avalonia.Visuals\Rendering\DeferredRenderer.cs:line 310
   at Avalonia.Rendering.DeferredRenderer.Render(Boolean forceComposite) in C:\GitHub\Avalonia\src\Avalonia.Visuals\Rendering\DeferredRenderer.cs:line 266
   at Avalonia.Rendering.DeferredRenderer.Avalonia.Rendering.IRenderLoopTask.Render() in C:\GitHub\Avalonia\src\Avalonia.Visuals\Rendering\DeferredRenderer.cs:line 220
   at Avalonia.Rendering.RenderLoop.TimerTick(TimeSpan time) in C:\GitHub\Avalonia\src\Avalonia.Visuals\Rendering\RenderLoop.cs:line 147' (RenderLoop #66629781)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
workgroupengineeringcommented, Nov 13, 2020

Another update, everything works fine by setting AllowEglInitialization = True and IRenderTimer to UiThreadRenderTimer. Probably ANGLE allows access to memory only to the Thread that created the context.

1reaction
maxkatz6commented, Nov 13, 2020

Just for case, with AllowEglInitialization disabled, application will use software renderer. For some applications it can cause worse rendering performance.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to design a window render loop? - c++
My short answer would have been: Use std::function instead of a raw function pointer. This gives you much more flexibility as it can...
Read more >
[solved] Custom Rendering Loop Error
I'm trying to implement a custom rendering loop, but I've got some problem using Ogre::WindowEventUtilities::messagePump function.
Read more >
WPF Hanging in Infinite Rendering Loop - Rick Strahl's Web Log
Ran into a nasty WPF bug this week with Markdown Monster that caused MM to hang during startup in certain scenarios.
Read more >
Game loop on windows - c++
I have an EVGA NVidia GeForce GTX 750Ti 2GB with overclocking and dual fan coolant running on Windows 7 64bit with 8GB Ram...
Read more >
Event Loop — Python 3.11.4 documentation
An instance of asyncio.TimerHandle is returned which can be used to cancel the callback. callback will be called exactly once. If two callbacks...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found