Wpf: OOM: DUCE+Channel.SyncFlush()

Created on 8 Dec 2018  路  12Comments  路  Source: dotnet/wpf

From telemetry, app crash:

System.OutOfMemoryException: Insufficient memory to continue the execution of the program.
   at MS.Internal.HRESULT.Check(int hr)
   at System.Windows.Media.Composition.DUCE+Channel.SyncFlush()
   at System.Windows.Interop.HwndTarget.UpdateWindowSettings(bool enableRenderTarget, Nullable<T> channelSet)
   at System.Windows.Interop.HwndTarget.UpdateWindowSettings(bool enableRenderTarget)
   at System.Windows.Interop.HwndTarget.OnShowWindow(bool enableRenderTarget)
   at System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, object args, int numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source, Delegate callback, object args, int numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, object args, int numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, object args, int numArgs)
   at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, object arg)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam)
issue-type-bug needs-more-info needs-watson-data

Most helpful comment

I have been getting this for years in telemetry from hundreds of users, with slight variation of Stack Trace:

System.OutOfMemoryException: Insufficient memory to continue the execution of the program.
   at System.Windows.Media.Composition.DUCE.Channel.SyncFlush()
   at System.Windows.Interop.HwndTarget.UpdateWindowSettings(Boolean enableRenderTarget, Nullable`1 channelSet)
   at System.Windows.Interop.HwndTarget.UpdateWindowPos(IntPtr lParam)
   at System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

and

System.Runtime.InteropServices.COMException (0x88980406): UCEERR_RENDERTHREADFAILURE (Excepci贸n de HRESULT: 0x88980406)
   en System.Windows.Media.Composition.DUCE.Channel.SyncFlush()
   en System.Windows.Interop.HwndTarget.UpdateWindowSettings(Boolean enableRenderTarget, Nullable`1 channelSet)
   en System.Windows.Interop.HwndTarget.UpdateWindowPos(IntPtr lParam)
   en System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam)
   en System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   en MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   en MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   en System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   en System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

-Sometimes happening seconds after starting program and sometimes after hours of running.
-Sometimes first time it happens after 100 runs
-All possible graphic cards, from Quadro to integrated; From Windows 7 to latest one
-Most recenlty one user reached out, checked that they had the lastest GPU driver, and he said it happened as he restored the window, seeing "only empty windows aero frame/container is visible", computer went to sleep a few times during that day, and after restarting PC he could not reproduce the error
-WPF, from .NET 4.5 - 4.8; no winforms elements

I have never caught it, but if there is something that an average user could do to help debug, or any other info, I can popup a message the next time exception contains SyncFlush() asking user to send more specific information

All 12 comments

We鈥檒l need a heap dump to investigate this further. _Syncflush_ is a catch-all signature.

This can be a real OOM, or a proxy for another kind of resource exhaustion (GDI handle, which incidentally has a per-session limit).

Not sure I'll be able to get that, but WER may have it. Unfortunately, I don't have access to that data. It's coming from telemetry :/

I鈥檒l see if I can find additional data and/or crash dumps.

If it helps, they might be tied to its Store AppId: 9WZDNCRDMDM3. It has a bunch of crash data that's not available to me. It might be available to you.

Hi @vatsan-madhavan,

I'm encountering this issue as well, I've got a memory dump that was captured while our managed code in the UnhandledDispatcherException. How can I provide this to you? One thing to note, our application is using WindowsFormIntegration.

I'm having the same crash with slightly different stack:

System.OutOfMemoryException: Insufficient memory to continue the execution of the program.  
    at System.Windows.Media.Composition.DUCE.Channel.SyncFlush()    
    at System.Windows.Interop.HwndTarget.UpdateWindowSettings(Boolean enableRenderTarget, Nullable`1 channelSet)    
    at System.Windows.Interop.HwndTarget.UpdateWindowPos(IntPtr lParam)     
    at System.Windows.Interop.HwndTarget.OnWindowPosChanging(IntPtr lParam)     
    at System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam)     
    at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)    
    at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)     
    at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)  
    at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)    
    at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)  
    at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)     
    at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)  

System.OutOfMemoryException: Insufficient memory to continue the execution of the program.  
    at System.Windows.Media.Composition.DUCE.Channel.SyncFlush()    
    at System.Windows.Interop.HwndTarget.UpdateWindowSettings(Boolean enableRenderTarget, Nullable`1 channelSet)    
    at System.Windows.Interop.HwndTarget.UpdateWindowPos(IntPtr lParam)     
    at System.Windows.Interop.HwndTarget.OnWindowPosChanging(IntPtr lParam)     
    at System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam)     
    at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)    
    at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)     
    at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)  
    at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)    
    at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)  
    at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)     
    at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)  

System.OutOfMemoryException: Insufficient memory to continue the execution of the program.  
    at System.Windows.Media.Composition.DUCE.Channel.SyncFlush()    
    at System.Windows.Interop.HwndTarget.UpdateWindowSettings(Boolean enableRenderTarget, Nullable`1 channelSet)    
    at System.Windows.Interop.HwndTarget.UpdateWindowPos(IntPtr lParam)     
    at System.Windows.Interop.HwndTarget.OnWindowPosChanging(IntPtr lParam)     
    at System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam)     
    at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)    
    at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)     
    at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)  
    at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)    
    at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)  
    at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)     
    at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)  

System.OutOfMemoryException: Insufficient memory to continue the execution of the program.  
    at System.Windows.Media.Composition.DUCE.Channel.SyncFlush()    
    at System.Windows.Interop.HwndTarget.UpdateWindowSettings(Boolean enableRenderTarget, Nullable`1 channelSet)    
    at System.Windows.Interop.HwndTarget.UpdateWindowPos(IntPtr lParam)     
    at System.Windows.Interop.HwndTarget.OnWindowPosChanging(IntPtr lParam)     
    at System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam)     
    at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)    
    at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)     
    at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)  
    at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)    
    at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)  
    at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)     
    at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
  1. The bug is reproducible but it takes a while to do so.
  2. The app is composed from WinForms and WPF.
  3. Can it be related to this error in StackOverflow?

@itsho, Is this in .NET Core of .NET Framework?
@SamBent Did you make wpfx.dll work on .NET Core yet?

@vatsan-madhavan it's .NET framework

I have been getting this for years in telemetry from hundreds of users, with slight variation of Stack Trace:

System.OutOfMemoryException: Insufficient memory to continue the execution of the program.
   at System.Windows.Media.Composition.DUCE.Channel.SyncFlush()
   at System.Windows.Interop.HwndTarget.UpdateWindowSettings(Boolean enableRenderTarget, Nullable`1 channelSet)
   at System.Windows.Interop.HwndTarget.UpdateWindowPos(IntPtr lParam)
   at System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

and

System.Runtime.InteropServices.COMException (0x88980406): UCEERR_RENDERTHREADFAILURE (Excepci贸n de HRESULT: 0x88980406)
   en System.Windows.Media.Composition.DUCE.Channel.SyncFlush()
   en System.Windows.Interop.HwndTarget.UpdateWindowSettings(Boolean enableRenderTarget, Nullable`1 channelSet)
   en System.Windows.Interop.HwndTarget.UpdateWindowPos(IntPtr lParam)
   en System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam)
   en System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   en MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   en MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   en System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   en System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

-Sometimes happening seconds after starting program and sometimes after hours of running.
-Sometimes first time it happens after 100 runs
-All possible graphic cards, from Quadro to integrated; From Windows 7 to latest one
-Most recenlty one user reached out, checked that they had the lastest GPU driver, and he said it happened as he restored the window, seeing "only empty windows aero frame/container is visible", computer went to sleep a few times during that day, and after restarting PC he could not reproduce the error
-WPF, from .NET 4.5 - 4.8; no winforms elements

I have never caught it, but if there is something that an average user could do to help debug, or any other info, I can popup a message the next time exception contains SyncFlush() asking user to send more specific information

Same issue in my application, in .net framework 4.6.
Same log with above.

I have the same issue but only on Windows Server 2012 and Windows 8.

Exact same stacktrace as above.

To everyone who has the same exception and callstack: You probably don't have the same issue, it may not be WPF's fault, and the WPF team can't help you without more detailed information. Please read https://docs.microsoft.com/en-us/troubleshoot/dotnet/framework/wpf-render-thread-failures for a fuller discussion.

I'm closing this issue, as it's not actionable without more information.

Was this page helpful?
0 / 5 - 0 ratings