TechnionYP5777 / Smartcity-Smarthouse

Smartcity-Smarthouse
11 stars 5 forks source link

Widgets bug? #211

Closed RonGatenio closed 7 years ago

RonGatenio commented 7 years ago

We think that after the graph widgets absorbs a lot of data, it crashes!

2017-06-19 13:06:35 ERROR [JavaFX Application Thread] failure_detector.SystemFailureDetector#logException (SystemFailureDetector.java:40) - 
    Uncaught exception from thread [JavaFX Application Thread]
    Exception: java.lang.NullPointerException
java.lang.NullPointerException
    at com.sun.scenario.animation.AbstractMasterTimer.timePulseImpl(AbstractMasterTimer.java:344)
    at com.sun.scenario.animation.AbstractMasterTimer$MainLoop.run(AbstractMasterTimer.java:267)
    at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:506)
    at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:490)
    at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$404(QuantumToolkit.java:319)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
    at java.lang.Thread.run(Unknown Source)

I know the error doesn't explain anything, but that is all we got

EliaTraore commented 7 years ago

Widgets Bug!!

RonGatenio commented 7 years ago

Take a look here, and pay attention to the line graph: bug

Note that the second error is from the failure detector... because of JavaFX's Alert.showAndWait... this is not the main error, only a by-product

ylevv commented 7 years ago

I think I know how to solve this... @EliaTraore may I help you?

EliaTraore commented 7 years ago

Go ahead! 😄 Whats the solution?

ylevv commented 7 years ago

Removed the 1st data point if we have more than maxDataSize data points overall and moved the number of data points to a field so it won't be influenced by their removal.

inbalzukerman commented 7 years ago

Not trying to be the party pooper, but I was trying the stove app (what @RonGatenio showed in the GIF above) and it doesn't work so well... Is it an error on my end?

RonGatenio commented 7 years ago

weird... worked for me... => heisenbug 😭

EliaTraore commented 7 years ago

Does this help?

EliaTraore commented 7 years ago

+ @inbalzukerman you're always the party pooper :stuck_out_tongue_winking_eye:

ylevv commented 7 years ago

Now I get this exception (not always, sometimes I get the original exception):

java.util.ConcurrentModificationException
        at java.util.AbstractList$Itr.checkForComodification(AbstractList.java:386)
        at java.util.AbstractList$Itr.next(AbstractList.java:355)
        at javafx.scene.chart.LineChart.updateAxisRange(LineChart.java:203)
        at javafx.scene.chart.XYChart.layoutChartChildren(XYChart.java:660)
        at javafx.scene.chart.Chart$1.layoutChildren(Chart.java:94)
        at javafx.scene.Parent.layout(Parent.java:1087)
        at javafx.scene.Parent.layout(Parent.java:1093)
        at javafx.scene.Parent.layout(Parent.java:1093)
        at javafx.scene.Parent.layout(Parent.java:1093)
        at javafx.scene.Parent.layout(Parent.java:1093)
        at javafx.scene.Parent.layout(Parent.java:1093)
        at javafx.scene.Parent.layout(Parent.java:1093)
        at javafx.scene.Parent.layout(Parent.java:1093)
        at javafx.scene.Parent.layout(Parent.java:1093)
        at javafx.scene.Parent.layout(Parent.java:1093)
        at javafx.scene.Parent.layout(Parent.java:1093)
        at javafx.scene.Parent.layout(Parent.java:1093)
        at javafx.scene.Parent.layout(Parent.java:1093)
        at javafx.scene.Parent.layout(Parent.java:1093)
        at javafx.scene.Parent.layout(Parent.java:1093)
        at javafx.scene.Scene.doLayoutPass(Scene.java:552)
        at javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2397)
        at com.sun.javafx.tk.Toolkit.lambda$runPulse$30(Toolkit.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:354)
        at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:381)
        at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:510)
        at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:490)
        at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$404(QuantumToolkit.java:319)
        at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
        at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
        at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
        at java.lang.Thread.run(Thread.java:745)

Plus, I noticed two more things:

inbalzukerman commented 7 years ago

@EliaTraore - I totally knew you're going to say something like that 😢

Anyway: The problems I encountered are:

EliaTraore commented 7 years ago

I think the java.util.ConcurrentModificationException is a result of the underlaying list not being updated in a blocking manner, which means that even thought the update itself is done one at a time, the concurrency still is problematic in the back. If that is the case, the only solution will be to add Thread.sleep(x) at the end of the update to make sure the information updates correctly, which might slow the GUI too much (and still not always work). So if it is, I think it's fair write it off as a known bug and leave it (unless any of you want to take it up on yourself to fix hansolo's code :wink: )

ylevv commented 7 years ago

If the synchronized was supposed to solve the bug, apparently it doesn't so we can remove it and stay with one type of exceptions instead of two 😅

EliaTraore commented 7 years ago

We concluded the the accumulation of data in the discussed widget is not threa-safe, causing mentioned bug. We decided to try and implement a thread safe version or find an alternative widget during Guinea-pig Milestone (#214), and if not - decide between writing it off as a known bug or removing it altogether. In any case, this issue can be closed.

EliaTraore commented 7 years ago

also, solved ^ by Javafx's producer-consumer