shuffleboard icon indicating copy to clipboard operation
shuffleboard copied to clipboard

Shuffleboard wasting resources

Open shaked113021 opened this issue 5 years ago • 13 comments

Our team uses shuffleboard to display values to the drivers. In the last couple of days, shuffleboard suddenly started taking crazy amounts of memory and processing power. Almost 90% cpu power and 8 gb of RAM and it also started lagging like crazy (even though by looking in outline viewer we can clearly see that they are updating normally)

shaked113021 avatar Feb 20 '20 23:02 shaked113021

Are you using graphs of any kind?

Daltz333 avatar Feb 20 '20 23:02 Daltz333

We are using a combo box for path choosing, for everything else we use text views which are for displaying and retrieving data. No graphs.

shaked113021 avatar Feb 21 '20 00:02 shaked113021

What about cameras? Can you post your save file?

sciencewhiz avatar Feb 21 '20 04:02 sciencewhiz

We don't save files nor cameras, for now we solved the problem, we accidentally used enableActuatorWidgets in an inappropriate place. Shuffleboard is still showing very high memory usage, using JProfiler I have discovered that it creates a lot of weakreferences,the number of which is growing abnormally. they all on WeakReferenceQueues(part of javafx) which is used in the Classes DataFormat, ConstraintBase, PathElement and Transform(and their child classes).

shaked113021 avatar Feb 21 '20 11:02 shaked113021

Hm. I can't seem to reproduce, do you have any test case?

Daltz333 avatar Feb 21 '20 14:02 Daltz333

Hm. I can't seem to reproduce, do you have any test case?

Yes, we added you as a collaborator to our repo. OnyxTronix2020

AE173 avatar Feb 22 '20 20:02 AE173

Hm. I can't seem to reproduce, do you have any test case?

Yes, we added you as a collaborator to our repo. OnyxTronix2020

Please use branch develop as test case

shaked113021 avatar Feb 22 '20 22:02 shaked113021

Contrary to what @shaked113021 said, it didn't solved our problem, the shuffleboard seams to freeze after we enable our robot. @Daltz333 We really need a quick fix for that as we are getting close to our first competition. Thank you for your help!

nimrod46 avatar Feb 22 '20 22:02 nimrod46

I can't seem to find anything obvious, but I ran your code on my desktop using the WPILib Sim and my CPU usage never rose over 5% and RAM over 550MB.

There have been issues with LiveWindow and performance in the past, could you try disabling any LiveWindow related functions and seeing the performance then?

Specs: Ryzen 5 1500x GTX 970 DDR4 2800MHz RAM SATA SSD

Daltz333 avatar Feb 23 '20 04:02 Daltz333

@Daltz333 I don't think it's possible to reproduce the problem while simming.

How can we disable the LiveWondow completely?

nimrod46 avatar Feb 23 '20 08:02 nimrod46

I can't seem to find anything obvious, but I ran your code on my desktop using the WPILib Sim and my CPU usage never rose over 5% and RAM over 550MB.

There have been issues with LiveWindow and performance in the past, could you try disabling any LiveWindow related functions and seeing the performance then?

Specs: Ryzen 5 1500x GTX 970 DDR4 2800MHz RAM SATA SSD

We managed to fix the issue using LiveWindow.disableAllTelemetry();. Apparently the Shuffleboard gets stuck after moving the robot (pushing the robot in disable mode as well). F.Y.I, We tried defining our motors without using WPI_ classes which did not help :/.

Thank you all for your help, we will keep this issue open...

AE173 avatar Feb 23 '20 14:02 AE173

So LiveWindow was the cause? Thanks.

Daltz333 avatar Feb 23 '20 14:02 Daltz333

Shuffleboard memory leaks could also be happening due to multiple ObservableValue objects being created but not garbage collected everytime a listener is triggered.

From: https://docs.oracle.com/javase/8/javafx/api/javafx/beans/value/ObservableValue.html#addListener-javafx.beans.value.ChangeListener-

The ObservableValue stores a strong reference to the listener which will prevent the listener from being garbage collected and may result in a memory leak. It is recommended to either unregister a listener by calling removeListener after use or to use an instance of WeakChangeListener avoid this situation.

neel-j-dev avatar Mar 21 '20 21:03 neel-j-dev