constellation icon indicating copy to clipboard operation
constellation copied to clipboard

Notes View Auto Notes are not refreshing every time

Open aldebaran30701 opened this issue 2 years ago • 2 comments

Prerequisites

  • [ ] Put an X between the brackets on this line if you have done all of the following:

    • Running the latest version of Constellation

    • Attached the Support Package via Help > Support Package

    • Checked the FAQs: https://github.com/constellation-app/constellation/wiki/FAQ

    • Checked that your issue isn’t already filed: https://github.com/constellation-app/constellation/issues

    • Checked that there is not already a module that provides the described functionality: https://github.com/constellation-app/constellation/wiki/Catalogue-of-Repositories

Description

When testing another ticket on master, I was able to find a bug. The bug is relating to aut notes not refreshing the UI pane when created. This happens 60% of the time, and seems to possibly be a race condition as it is not 100% accurate with the timing.

What you see in the gif below is that the notes disappear when created via automatic add. It also appears that when changing between graphs, one of the notes gets missed.

notes-not-appearing

[Description of the issue]

Steps to Reproduce

1 Open Constellation
2 Open Notes View
3 Open Graph
4 Create a new user note
5 repeat 4 until filled the UI pane
6 new note should appear at the very bottom and autoscroll to the bottom of the pane
7 Generate an auto note using select in box
8 ensure user notes, auto notes are selected in the filter
9 auto note should appear at the bottom

Expected behaviour: [What you expect to happen] Auto note should be added 100% of the time, when finished executing.

Actual behaviour: [What actually happens] Auto note is not actually added to the UI - switching graph tabs refreshes the UI. Reproduces how often: [What percentage of the time does it reproduce?]

Additional Information

This seems to sound like the note is getting saved to the graph correctly, but not actually triggering a UI refresh. The pluginreporter seems to report all plugin reports as intended, so that leads me to believe that it is with the notes view specifically Any additional information, configuration or data that might be necessary to reproduce the issue.

aldebaran30701 avatar Oct 27 '21 02:10 aldebaran30701

After some initial investigation, I've discovered the issue here appears to be NodeViewStateReader. Specifically: pane.setNotes(new ArrayList<>(currentState.getNotes()));

The issue here is that setNotes is being passed a copy of the list of notes which if the list hasn't quite updated yet means that it is not getting the correct updated list. Changing this to pass in the actual list itself instead (i.e. pane.setNotes(currentState.getNotes());) appears to resolve the issue. Trouble here though is that passing in a copy of the list was a change made to fix a concurrent mod issue that was being flagged (#1342), and so reversing this will likely bring that this issue.

Some further work therefore will need to be done to figure out how to have both issues (concurrent mod and this issue) resolved at the same time

EDIT: After reverting the change locally, I can't seem to reproduce the concurrent mod exception. @arcturus2 I know it's been a while since you identified and fixed this but do you recall more specifics on the reproducer you specified in the other ticket? I've tried hopping out over and over again on a 10000 node 10000 transaction sphere graph but no luck

antares1470 avatar Jul 21 '22 05:07 antares1470

Ok I ended up figuring out the underlying issue. NotesViewTopComponent.newPluginReport calls 2 functions: NotesViewController.readState() and NotesViewPane.setGraphReport(). The trouble with this is that both functions end up interacting with the same objects as each other on separate threads and consequently behaviour is affected by the order in which the threads interact with the objects. Removing the readState call remedied the issue with auto notes displaying, but this uncovered another issue whereby the filter tag dropdown wasn't being updated correctly until the next auto note was generated. This issue here ended up being that it was trying to update the tag list before the note had been added and so it wasn't picking up the tags of the note that was being added. Moving the tag list update to after the note had been added resolved the issue.

antares1470 avatar Jul 27 '22 02:07 antares1470

Thanks @antares1470 for all your efforts with working out the cause of this tricky bug! I have tried it out with some new graphs with the 2.8 release candidate and it is working as I would expect and I am not seeing the issue described in the issue description. Thanks again!

GammaVel avatar Aug 30 '22 01:08 GammaVel