teragrep / ajs_01

User interface for Teragrep
Apache License 2.0
0 stars 1 forks source link

Endless loading animation #309

Open ronja-ui opened 2 weeks ago

ronja-ui commented 2 weeks ago

Describe the bug Sometimes the raw data gets stuck in endless loading animation after the paragraph run has finished.

Expected behavior Paragraph should show results after the paragraph run has finished or show error message if there's something failed.

How to reproduce

| teragrep get system version

Screenshots

Software version ajs_01 8.4.2 pth_07 7.2.5

Desktop (please complete the following information if relevant):

Additional context

09.57.07 - BVVLD: sometimes server instead of sending AJAX response sends an empty error message and that causes table to load endlessly, until reload, after which there is a new AJAX request, which server responds correctly

Laukkala commented 1 day ago

Can be reproduced by having two users connect to the same notebook.

Steps taken: User A creates a new notebook and opens it automatically User A gives User B owner permissions to notebook User B opens the same notebook User A adds the script "%dpl | teragrep get system version" to the first paragraph User A runs first paragraph User B refreshes page as soon as results are coming in User A sees results as normal User B sees an infinite loading screen User B sees infinite loading screen even if he refreshes If User A refreshes, User B's results get updated properly

BVVLD commented 1 day ago

Can be reproduced by having two users connect to the same notebook.

Steps taken: User A creates a new notebook and opens it automatically User A gives User B owner permissions to notebook User B opens the same notebook User A adds the script "%dpl | teragrep get system version" to the first paragraph User A runs first paragraph User B refreshes page as soon as results are coming in User A sees results as normal User B sees an infinite loading screen User B sees infinite loading screen even if he refreshes If User A refreshes, User B's results get updated properly

Additional info: the bug seems to reproduce if combination of users is new every time in the session. With same user set the bug may not occur even when following steps above.

BVVLD commented 1 day ago

The problem seems to be bound to the DataTable server-side table implementation, to the sync logic of AJAX in particular.

what happens when two unique users try to run one raw-data paragraph?

  1. server starts to send a lot of empty error info messages
  2. Server creates a correct table skeleton and updates DTAnchorReady triggering UI to create a table for raw-data rendering.
  3. Server continues to fire empty error info messages
  4. UI does its thing and table asks for first update with AJAXRequest. The sync ID is 1.
  5. Server correctly sends the AJAXResponse for sync ID 1. HOWEVER, UI does not accept it, because somehow it already expects the sync ID 2.
  6. The table continues to load indefinitely, since there is mismatch in update ID and no logic for recovering. This is fixed only on restart.
BVVLD commented 1 day ago

current decision on the fix:

a complete solution would be perhaps like this: both on ui and server: 1) each angular (or other) variable (which are updateable) has a version counter on server: 2) each change to a such variable updates global update counter by one, and server broadcasts this update to the clients with the global update counter on ui: 3) ui updates the broadcasted variable update only if the ui local version of the global update counter is one less than the server update counter, otherwise UI asks for update of all variables, including the global update counter.

the problem is a theoretical and closely related to https://en.wikipedia.org/wiki/Version_vector