Skip to content

OOM: DUCE+Channel.SyncFlush() #128

Closed

Description

@clairernovotny

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)

Activity

  1. vatsan-madhavan commented on Dec 8, 2018

    @vatsan-madhavan
    Member

    We’ll 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).

  2. added
    Bug
    needs more information
    on Dec 8, 2018
  3. clairernovotny commented on Dec 8, 2018

    @clairernovotny
    Author

    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 :/

  4. added this to the Future milestone on Dec 8, 2018
  5. vatsan-madhavan commented on Dec 8, 2018

    @vatsan-madhavan
    Member

    I’ll see if I can find additional data and/or crash dumps.

  6. clairernovotny commented on Dec 8, 2018

    @clairernovotny
    Author

    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.

  7. mrbcmorris commented on Mar 5, 2019

    @mrbcmorris

    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.

  8. removed their assignment
    on May 29, 2019
  9. added
    needs-watson-data
    on May 29, 2019
  10. itsho commented on Sep 8, 2020

    @itsho

    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?
  11. vatsan-madhavan commented on Sep 8, 2020

    @vatsan-madhavan
    Member

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

  12. itsho commented on Sep 8, 2020

    @itsho

    @vatsan-madhavan it's .NET framework

  13. milos12345 commented on Oct 29, 2020

    @milos12345

    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

  14. jingsong-liu commented on Nov 2, 2020

    @jingsong-liu

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

  15. theindra commented on Nov 12, 2020

    @theindra

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

    Exact same stacktrace as above.

  16. SamBent commented on Nov 30, 2020

    @SamBent
    Contributor

    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.

  17. milos12345 commented on Apr 16, 2021

    @milos12345

    In my crash log this error precedes SyncFlush crash by a second

       в Standard.NativeMethods.DwmExtendFrameIntoClientArea(IntPtr hwnd, MARGINS& pMarInset)
       в System.Windows.Shell.WindowChromeWorker._ExtendGlassFrame()
       в System.Windows.Shell.WindowChromeWorker._UpdateFrameState(Boolean force)
       в System.Windows.Shell.WindowChromeWorker._HandleDwmCompositionChanged(WM uMsg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       в System.Windows.Shell.WindowChromeWorker._WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       в System.Windows.Interop.HwndSource.PublicHooksFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       в MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       в MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
       в System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       в System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
    

    Unless I've made mistake in the logging, the window was minimized at the time of the crash and didn't have a focus. I also have that GDI handles count in moment of crash were 120

  18. ghost locked as resolved and limited conversation to collaborators on Apr 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugneeds more informationneeds-watson-data

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions