New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Concurrent requests when removing widget may persist it again #4525

Closed
edmundoa opened this Issue Jan 25, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@edmundoa
Member

edmundoa commented Jan 25, 2018

Deleting a widget from the web interface may not end up deleting the widget as expected. The reason for this is that two requests are made in very short time when deleting a widget:

  1. User clicks on "Delete" button on a widget
  2. React Grid Layout calls the onDragStop callback, which triggers an update to the server to update the dashboard positions
  3. The JS code eventually stops, since we ask for user confirmation before sending the delete request to the server
  4. Both the update positions and delete requests are sent to the server (if the user confirmed the deletion)
  5. Depending on which of the requests is executed first, this situation potentially leads to a widget being removed from the dashboard document just to be stored again in the other request
  6. Subsequent requests to the dashboard resource will include the "removed" widget, since it is still in MongoDB, and that's why the widget does not disappear from the dashboard

Here is a gif of how it looks like:

widget

And here is the only log available in the server (there are no logs in browser JS console):

2018-01-25 14:19:05,794 INFO : org.graylog2.rest.resources.dashboards.DashboardWidgetsResource - Deleted widget <7778a1fa-983f-42d5-a8a7-b2196ccf8f06> from dashboard <5a68b21258ddc87f325a5b7a>. Reason: REST request.

Expected Behavior

Deleting a widget from the web interface works as expected.

Current Behavior

Deleting a widget from the web interface may not delete the widget after all.

Steps to Reproduce (for bugs)

  1. Go to a dashboard and enter "edit" mode
  2. Delete a widget and confirm the action
  3. If you are (un)lucky the widget comes back again (see gif above)

Your Environment

  • Graylog Version: Graylog 3.0.0-SNAPSHOT(c839182) and Graylog 2.4.3

@edmundoa edmundoa added the bug label Jan 25, 2018

@edmundoa edmundoa added this to the 2.4.4 milestone Jan 25, 2018

@edmundoa edmundoa self-assigned this Jan 25, 2018

@wafflebot wafflebot bot added the in progress label Jan 25, 2018

@jalogisch jalogisch added the triaged label Jan 29, 2018

@kmerz kmerz closed this in #4530 Feb 23, 2018

edmundoa added a commit that referenced this issue May 28, 2018

Do not update positions after click in widget actions
Clicking anywhere on an unlocked widget generates a drag event, which in
our case ends up sending a request to the server to update widgets
positions.
Use React Grid Layout `draggableCancel` prop, to avoid calling drag
callbacks when a user clicks on the edit or delete buttons for a widget.

Partial backport of 9488608 (#4530).
Mitigates #4525

bernd added a commit that referenced this issue May 28, 2018

Do not update positions after click in widget actions (#4808)
Clicking anywhere on an unlocked widget generates a drag event, which in
our case ends up sending a request to the server to update widgets
positions.
Use React Grid Layout `draggableCancel` prop, to avoid calling drag
callbacks when a user clicks on the edit or delete buttons for a widget.

Partial backport of 9488608 (#4530).
Mitigates #4525
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment