constellation-app / constellation

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

Constellation freezes when opening DAV or CQV on a newly built sphere graph #170

Closed formalhaut69 closed 4 years ago

formalhaut69 commented 4 years ago

Prerequisites

SupportPackage-klewis47-2019-12-18-09-52-52.zip

Description

The application freezes when opening the data access view or the quality control view on a newly built sphere graph.

Steps to Reproduce

  1. Create a new analytic graph
  2. Experimental > Build Graph > Sphere Graph Builder
  3. Open the data access view or the quality control view

Expected behaviour: The view should open properly

Actual behaviour: Constellation freezes

Reproduces how often: 100%

Additional Information

This bug doesn't occur if the view is already open in memory when you launch constellation. It also doesn't seem to occur if constellation has been running for a few minutes.

formalhaut69 commented 4 years ago

Issue also seems to occur if you follow the same steps but instead of building a new sphere graph you just create a new node and then modify it's identifier in the attribute editor and then open the DAV or QCV. This is what is outputted to the console when the data access plugin is opened;

Constellation crash output

arcturus2 commented 4 years ago

I remember this happening to me too but I wasn't able to reproduce it and it seemed to have "gone away".

One theory is that there is a race condition occuring which effects the CountdownLatch not working as intended.

https://github.com/constellation-app/constellation/blob/27c9d4091cc84f7918d32239d3c14ae2c9e93490/CoreDataAccessView/src/au/gov/asd/tac/constellation/views/dataaccess/panes/DataAccessPane.java#L503

The latch not being released can explain why Constellation freezes (because that code is running on the graphics thread until final Thread thread = new Thread("Data Access View: Load Plugins") {} finishes.

Ironically, I think I moved the bulk of the code in lookupPlugins() to run on its own thread to improve performance.

If this issue can be reproduced reliably, I'd like my theory to be tested by setting a long timeout to see if it comes back after say 30 seconds.

countDownLatch.await(30, TimeUnit.SECONDS);

Also interested if anyone else has ideas.

cygnus-x-1 commented 4 years ago

I can't reproduce this.

aldebaran30701 commented 4 years ago

I managed to reproduce this 100% of the time following the issue steps. I did some brief digging and it appears to be lingering around the following two lines. Commenting them both out reveal the application does not hang or freeze when launching DAV. No QC event handlers would be active as a result of ridding these calls. (not a legitimate solution) It appears that DAV freeze is a different issue to QCV freeze. https://github.com/constellation-app/constellation/blob/27c9d4091cc84f7918d32239d3c14ae2c9e93490/CoreQualityControlView/src/au/gov/asd/tac/constellation/views/qualitycontrol/widget/DefaultQualityControlAutoButton.java#L64-L65 .getInstance() is a synchronised method to retrieve the singleton instance of QualityControlAutoVetter. https://github.com/constellation-app/constellation/blob/27c9d4091cc84f7918d32239d3c14ae2c9e93490/CoreQualityControlView/src/au/gov/asd/tac/constellation/views/qualitycontrol/daemon/QualityControlAutoVetter.java#L264-L271 The synchronisation may be getting blocked by another call, which is yet to be found. Any further thoughts are welcomed as to what could cause this.

formalhaut69 commented 4 years ago

I've taken a look at this issue and what appears to be happening is the "Quality Control View: Run Rule" thread is getting to the getRules() call on line 182 and is failing. https://github.com/constellation-app/constellation/blob/27c9d4091cc84f7918d32239d3c14ae2c9e93490/CoreQualityControlView/src/au/gov/asd/tac/constellation/views/qualitycontrol/daemon/QualityControlAutoVetter.java#L180-L187

Whilst the other thread that starts the "Quality Control View: Run Rule" thread is awaiting indefinitely for it to finish, which is why constellation is freezing. The debugger doesn't reveal much other than the thread stops at the getRules() call, doesn't enter the method and stops there.

I'll also note that if you add the timer of one 1 second to the countdownlatch.await() as suggested in @aldebaran30701's temporary solution, the "Quality Control View: Run Rule" thread continues.

Any suggestions would be greatly appreciated.