constellation-app / constellation

A graph-focused data visualisation and interactive analysis application.
https://constellation-app.com
Apache License 2.0
385 stars 59 forks source link

Fix null pointer and other exceptions in schema view #2194

Closed Quasar985 closed 1 week ago

Quasar985 commented 3 weeks ago

Prerequisites

Description of the Change

Added synchronize to functions so that rapid closing and opening of schema view doesn't throw errors.

Alternate Designs

N/A

Why Should This Be In Core?

N/A

Benefits

Bug fixes

Possible Drawbacks

None

Verification Process

  1. Open consty
  2. Open a graph
  3. Rapidly open and close schema view (schema view can be opened with ctrl-shift-s)
  4. Observe no exceptions are thrown

Applicable Issues

https://github.com/constellation-app/constellation/issues/2144

antares1470 commented 2 weeks ago

Another observation I made was that if you spam it enough times, there comes a point where the schema view starts to lag while trying to load (mostly when you got to memory limits) and to the point that it doesn't really load properly

Quasar985 commented 1 week ago

Still managed to get:

java.lang.NullPointerException: Cannot read field "children" because the return value of "javafx.scene.Node.getParent()" is null

javafx.graphics/javafx.scene.Parent$2.onChanged(Parent.java:340)
javafx.base/com.sun.javafx.collections.TrackableObservableList.lambda$new$0(TrackableObservableList.java:44)
javafx.base/com.sun.javafx.collections.ListListenerHelper$Generic.fireValueChangedEvent(ListListenerHelper.java:327)
javafx.base/com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:71)
javafx.base/javafx.collections.ObservableListBase.fireChange(ObservableListBase.java:246)
javafx.base/javafx.collections.ListChangeBuilder.commit(ListChangeBuilder.java:482)
javafx.base/javafx.collections.ListChangeBuilder.endChange(ListChangeBuilder.java:541)
javafx.base/javafx.collections.ObservableListBase.endChange(ObservableListBase.java:210)
javafx.base/javafx.collections.ModifiableObservableListBase.addAll(ModifiableObservableListBase.java:117)
javafx.base/com.sun.javafx.collections.VetoableListDecorator.addAll(VetoableListDecorator.java:241)
javafx.base/com.sun.javafx.collections.VetoableListDecorator.addAll(VetoableListDecorator.java:105)
javafx.graphics/javafx.scene.layout.VBox.<init>(VBox.java:240)
au.gov.asd.tac.constellation.views.schemaview.providers.VertexTypeNodeProvider.addFilter(VertexTypeNodeProvider.java:216)
au.gov.asd.tac.constellation.views.schemaview.providers.VertexTypeNodeProvider.setContent(VertexTypeNodeProvider.java:272)
au.gov.asd.tac.constellation.views.schemaview.SchemaViewPane.lambda$populate$0(SchemaViewPane.java:58)

Was following the reproducer you outlined (i.e. spamming Schema View open and close very quickly)

99% sure I've fixed with the newest commit. I tested with an auto-clicker that is able to open and close the schema view many times a second. This error rarely showed up to begin with, but I reckon I've got it fixed.

sonarcloud[bot] commented 1 week ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
50.0% Duplication on New Code

See analysis details on SonarCloud