LightBulb icon indicating copy to clipboard operation
LightBulb copied to clipboard

Lightbulb memory explosion

Open mirh opened this issue 7 years ago • 29 comments

So.. While I was checking the other computer for #29, I right clicked on LB icon... And nothing happened. I tried again, again, again and nothing. So I opened task manager and I noticed that LB was like 300MB of memory.... Whatever I thought? Then I clicked again and.. boy, it skyrocketed to 1.2GB Then it suddenly went down to 100, last but not least like 200 and it crashed. All without never ever showing the settings menu.

Application: LightBulb.exe
Frramework version: v4.0.30319
Description: the process was terminated due to an unhandled exception.
Exception Info: System.OutOfMemoryException
   in System.Windows.Media.Composition.DUCE+Channel.SyncFlush()
   in System.Windows.Interop.HwndTarget.UpdateWindowSettings(Boolean, System.Nullable`1<ChannelSet>)
   in System.Windows.Interop.HwndTarget.UpdateWindowPos(IntPtr)
   in System.Windows.Interop.HwndTarget.HandleMessage(MS.Internal.Interop.WindowMessage, IntPtr, IntPtr)
   in System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   in MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
   in MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
   in System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
   in System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
   in System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
   in MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
   in MS.Win32.UnsafeNativeMethods.SetWindowPos(System.Runtime.InteropServices.HandleRef, System.Runtime.InteropServices.HandleRef, Int32, Int32, Int32, Int32, Int32)
   in System.Windows.Interop.HwndSource.Resize(System.Windows.Size)
   in System.Windows.Interop.HwndSource.OnLayoutUpdated(System.Object, System.EventArgs)
   in System.Windows.ContextLayoutManager.fireLayoutUpdateEvent()
   in System.Windows.ContextLayoutManager.UpdateLayout()
   in System.Windows.UIElement.UpdateLayout()
   in System.Windows.Interop.HwndSource.SetLayoutSize()
   in System.Windows.Interop.HwndSource.set_RootVisualInternal(System.Windows.Media.Visual)
   in System.Windows.Interop.HwndSource.set_RootVisual(System.Windows.Media.Visual)
   in System.Windows.Controls.Primitives.Popup.SetRootVisualToPopupRoot()
   in System.Windows.Controls.Primitives.Popup.CreateWindow(Boolean)
   in System.Windows.Controls.Primitives.Popup.OnIsOpenChanged(System.Windows.DependencyObject, System.Windows.DependencyPropertyChangedEventArgs)
   in System.Windows.DependencyObject.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs)
   in System.Windows.FrameworkElement.OnPropertyChanged(System.Windows.DependencyPropertyChangedEventArgs)
   in System.Windows.DependencyObject.NotifyPropertyChange(System.Windows.DependencyPropertyChangedEventArgs)
   in System.Windows.DependencyObject.UpdateEffectiveValue(System.Windows.EntryIndex, System.Windows.DependencyProperty, System.Windows.PropertyMetadata, System.Windows.EffectiveValueEntry, System.Windows.EffectiveValueEntry ByRef, Boolean, Boolean, System.Windows.OperationType)
   in System.Windows.DependencyObject.InvalidateProperty(System.Windows.DependencyProperty, Boolean)
   in System.Windows.Data.BindingExpressionBase.Invalidate(Boolean)
   in System.Windows.Data.BindingExpression.TransferValue(System.Object, Boolean)
   in System.Windows.Data.BindingExpression.ScheduleTransfer(Boolean)
   in MS.Internal.Data.ClrBindingWorker.NewValueAvailable(Boolean, Boolean, Boolean)
   in MS.Internal.Data.PropertyPathWorker.UpdateSourceValueState(Int32, System.ComponentModel.ICollectionView, System.Object, Boolean)
   in MS.Internal.Data.PropertyPathWorker.OnDependencyPropertyChanged(System.Windows.DependencyObject, System.Windows.DependencyProperty, Boolean)
   in MS.Internal.Data.ClrBindingWorker.OnSourceInvalidation(System.Windows.DependencyObject, System.Windows.DependencyProperty, Boolean)
   in System.Windows.Data.BindingExpression.HandlePropertyInvalidation(System.Windows.DependencyObject, System.Windows.DependencyPropertyChangedEventArgs)
   in System.Windows.Data.BindingExpressionBase.OnPropertyInvalidation(System.Windows.DependencyObject, System.Windows.DependencyPropertyChangedEventArgs)
   in System.Windows.Data.BindingExpression.OnPropertyInvalidation(System.Windows.DependencyObject, System.Windows.DependencyPropertyChangedEventArgs)
   in System.Windows.DependentList.InvalidateDependents(System.Windows.DependencyObject, System.Windows.DependencyPropertyChangedEventArgs)
   in System.Windows.DependencyObject.NotifyPropertyChange(System.Windows.DependencyPropertyChangedEventArgs)
   in System.Windows.DependencyObject.UpdateEffectiveValue(System.Windows.EntryIndex, System.Windows.DependencyProperty, System.Windows.PropertyMetadata, System.Windows.EffectiveValueEntry, System.Windows.EffectiveValueEntry ByRef, Boolean, Boolean, System.Windows.OperationType)
   in System.Windows.DependencyObject.SetValueCommon(System.Windows.DependencyProperty, System.Object, System.Windows.PropertyMetadata, Boolean, Boolean, System.Windows.OperationType, Boolean)
   in System.Windows.DependencyObject.SetValue(System.Windows.DependencyProperty, System.Object)
   in Hardcodet.Wpf.TaskbarNotification.TaskbarIcon.OnToolTipChange(Boolean)
   in Hardcodet.Wpf.TaskbarNotification.Interop.WindowMessageSink.ProcessWindowMessage(UInt32, IntPtr, IntPtr)
   in Hardcodet.Wpf.TaskbarNotification.Interop.WindowMessageSink.OnWindowMessageReceived(IntPtr, UInt32, IntPtr, IntPtr)
   in MS.Win32.UnsafeNativeMethods.IntGetMessageW(System.Windows.Interop.MSG ByRef, System.Runtime.InteropServices.HandleRef, Int32, Int32)
   in MS.Win32.UnsafeNativeMethods.GetMessageW(System.Windows.Interop.MSG ByRef, System.Runtime.InteropServices.HandleRef, Int32, Int32)
   in System.Windows.Threading.Dispatcher.GetMessage(System.Windows.Interop.MSG ByRef, IntPtr, Int32, Int32)
   in System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
   in System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame)
   in System.Windows.Application.RunDispatcher(System.Object)
   in System.Windows.Application.RunInternal(System.Windows.Window)
   in System.Windows.Application.Run(System.Windows.Window)
   in LightBulb.App.Main()

Dump

mirh avatar Jun 12 '17 09:06 mirh

what the fuck

Tyrrrz avatar Jun 12 '17 12:06 Tyrrrz

are you using the version compiled from master branch, the last release or the installer i sent you?

Tyrrrz avatar Jun 12 '17 12:06 Tyrrrz

1.6.3.3 downloaded from release on that computer

mirh avatar Jun 12 '17 12:06 mirh

Can you consistently replicate this?

Tyrrrz avatar Jun 12 '17 17:06 Tyrrrz

I guess I'll have to wait another week of uptime before calling or not calling it a day. Also.. I'd have swore I had set night temperature to 6000K last month, but today when starting LB again it fell back to 3900 or something (default)

mirh avatar Jun 12 '17 17:06 mirh

So, I spotted the issue again on the PC. But this time, instead of clicking and clicking until it crashed, once I noticed the problem I stopped and the process is still running. Anything I could do to profile/report better it?

mirh avatar Jul 01 '17 11:07 mirh

Sorry I don't know what exactly is going wrong. On the machines I tested, I'm running LightBulb for full 5 days (I know it's not a week, but close) and the allocated memory is still at around 13mb.

Tyrrrz avatar Jul 05 '17 06:07 Tyrrrz

Well, I know, even on the famously stucking computer I'm getting low results (albeit I'm between 40 and 70MB to be honest)

On the other computer though.. Boom.

mirh avatar Jul 05 '17 10:07 mirh

Still relevant? :p

Tyrrrz avatar Aug 29 '17 16:08 Tyrrrz

Yes. (and I'm not sure how else it could be, given nothing changed in these months)

mirh avatar Aug 29 '17 18:08 mirh

Wanted to make sure. Found this: https://connect.microsoft.com/VisualStudio/feedback/details/799847/outofmemoryexception-in-wpf-rendering-thread-duce-channel-syncflush

Tyrrrz avatar Aug 29 '17 18:08 Tyrrrz

It just happened with me. Lightbulb was consuming over 200MB of RAM.

mrnhmath avatar Dec 10 '17 03:12 mrnhmath

Did it also crash? How did it happen? Was there anything else? Any reproduction steps?

Tyrrrz avatar Dec 10 '17 09:12 Tyrrrz

It didn't crash, happened during an Overwatch match. Maybe letting it open during a full day can reproduce the leak?

mrnhmath avatar Dec 10 '17 15:12 mrnhmath

I usually have it on for multiple consecutive weeks (I don't turn off my work PC) and it doesn't show symptoms of that issue. Can you check the newest release, just in case?

Tyrrrz avatar Dec 13 '17 11:12 Tyrrrz

My issue had nothing to do with "random memory leaks" summing up over time. It seems more <something that only becomes magic after some time> triggering all at once and.. exploding.

Anyway, yes will do.

mirh avatar Dec 13 '17 14:12 mirh

Still happening with last release?

Tyrrrz avatar Jan 13 '18 19:01 Tyrrrz

Duh, I hadn't noticed about 1.6.3.6 - will report

mirh avatar Jan 14 '18 14:01 mirh

Yep, still a thing.

mirh avatar Jan 22 '18 00:01 mirh

+1 here: over 300MB usage. LightBulb seemed to work feature-wise, but it was unresponsive to GUI interaction (i.e. left or right-clicking the tray icon produced not result).

I noticed I got this behavior only on my laptop so in my case, this seems to occur only when I use OS' "Hibernate" feature (haven't tried with "Sleep" mode)

polyvertex avatar Jun 30 '18 09:06 polyvertex

Fucking nailed it. On the W7 pc this time (after a mere 21 hours uptime), where I seemingly have enough ram that the explosion don't hit paging and can subsequently turn back to the "usual" 300MB.

With procexp I saw wpfgfx_v0400.dll!WgxConnection_ShouldForceSoftwareForGraphicsStreamClient+0x7f spikes in cpu usage when I try to open the right click menu.

mirh avatar Aug 07 '18 21:08 mirh

Nice, that's at least some info. Do you have an integrated GPU? Are your GPU drivers installed and working correctly?

Tyrrrz avatar Aug 09 '18 23:08 Tyrrrz

I have a radeon here, with kinda-last-drivers, and a geforce in the other one. There's no problem to report.

mirh avatar Aug 09 '18 23:08 mirh

@mirh hello darkness my old friend. Have you checked if our most favorite issue is reproducible on latest master builds?

Tyrrrz avatar Nov 08 '19 16:11 Tyrrrz

I would have said the other one was the most favorite (: Anyway, thing is unless this is made to work on 4.7, my very reproducible Vista cannot even start it. While on 7 pc it always take weeks to be able to say anything..

mirh avatar Nov 09 '19 17:11 mirh

You should be able to install .NET Core 3 on Vista, I believe.

Tyrrrz avatar Nov 09 '19 18:11 Tyrrrz

Nope, 4.7.2 is the most that will work (and even then it takes some slight hack)

mirh avatar Nov 09 '19 18:11 mirh

You're right, I can see it works on Windows 7 and up.

https://github.com/dotnet/core/blob/master/release-notes/3.0/3.0-supported-os.md

Tyrrrz avatar Nov 09 '19 18:11 Tyrrrz

Still have the issue on win10. dotnet.exe goes up to 9GB on my machine, triggering "System Rousource Exhaustion" and creating unstable system bahaviour (firefox and teams crashes, etc)

mokrates avatar Sep 05 '21 15:09 mokrates

LightBulb no longer runs via the .NET CLi (dotnet.exe) so it should be easier to see if the resource usage is caused by LightBulb or something else that also runs on .NET. Going to close it as stale again, reply with a comment if you can still reproduce it.

Tyrrrz avatar Nov 07 '23 13:11 Tyrrrz