Bug 1339751 - Issue with auto-refresh transactions not firing after they should
Summary: Issue with auto-refresh transactions not firing after they should
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Automate
Version: 5.5.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: GA
: 5.5.5
Assignee: eclarizi
QA Contact: Dmitry Misharov
URL: dialog
Whiteboard: automate
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-05-25 18:43 UTC by Jared Deubel
Modified: 2019-10-10 12:09 UTC (History)
12 users (show)

Fixed In Version: 5.5.5.2
Doc Type: Bug Fix
Doc Text:
Previously, there were issues with dialogs having auto-refresh set up on any of the fields. When fields changed, it immediately kicked off a trigger to auto-refresh, and that transaction completed before the field change transaction was complete. This was because the state of the form was being handled server side, instead of in the javascript, which caused problems. This update implements $.when for triggering auto-refresh callbacks and does not attempt to use callback if it does not exist.
Clone Of:
Environment:
Last Closed: 2016-07-26 15:34:53 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:1488 normal SHIPPED_LIVE CFME 5.5.5 bug fixes and enhancement update 2016-07-26 19:28:27 UTC

Description Jared Deubel 2016-05-25 18:43:36 UTC
Description of problem:

Issues with any dialog that has auto-refreshing set up on any of the fields. Now that we are using a concurrent web server, when fields change it was immediately kicking off a trigger to auto-refresh, and that transaction was completing before the field change transaction would be completed. Ideally, the field change wouldn't need a transaction and the state of the form would be handled in the javascript, but right now it's all handled server side so the order things were being done was causing problems.

Version-Release number of selected component (if applicable):
5.5

Comment 2 Greg McCullough 2016-05-25 21:04:14 UTC
Changing this bug over to 5.5.z.

The basic symptoms were originally reported on upstream and fixed in https://github.com/ManageIQ/manageiq/pull/7661 before 5.6 was branched.

Git Issue:
https://github.com/ManageIQ/manageiq/issues/7272

Talk Topics:
http://talk.manageiq.org/t/reading-dialog-form-values-from-a-refresh-event/1322
http://talk.manageiq.org/t/azure-windows-service-provisioning-failure-basic-information-parameters-virtual-machine-size-is-required/1320


My concern is that 5.5 used the Thin web-server which did not support concurrency.  The 5.6 build changed to use the Puma web-server which does support concurrency.  It is unclear at the moment how the customer could be running into this issue on 5.5.

MR https://gitlab.cloudforms.lab.eng.rdu2.redhat.com/cloudforms/cfme/merge_requests/952 was created for testing in their environment.

Comment 3 CFME Bot 2016-06-01 21:15:56 UTC
New commit detected on cfme/5.5.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=db188f27d79012338a9c108e54fbcbc31ec08777

commit db188f27d79012338a9c108e54fbcbc31ec08777
Author:     Erik Clarizio <eclarizi@redhat.com>
AuthorDate: Fri Apr 1 09:10:01 2016 -0700
Commit:     Erik Clarizio <eclarizi@redhat.com>
CommitDate: Wed May 25 13:24:42 2016 -0700

    Implement $.when for triggering auto-refresh callbacks
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1339751

 app/assets/javascripts/dialog_field_refresh.js     |  9 +++---
 app/assets/javascripts/miq_application.js          | 20 +++++++-----
 app/assets/javascripts/miq_ujs_bindings.js         | 36 ++++++++++++----------
 .../application_controller/dialog_runner.rb        | 11 -------
 4 files changed, 36 insertions(+), 40 deletions(-)

Comment 4 CFME Bot 2016-06-01 21:16:02 UTC
New commit detected on cfme/5.5.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=31a105b4815a6388bf2ef5bcc434668c8b8b1961

commit 31a105b4815a6388bf2ef5bcc434668c8b8b1961
Author:     Erik Clarizio <eclarizi@redhat.com>
AuthorDate: Fri Apr 1 13:05:25 2016 -0700
Commit:     Erik Clarizio <eclarizi@redhat.com>
CommitDate: Wed May 25 13:24:45 2016 -0700

    Fix specs to account for new way of executing trigger callback
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1339751

 spec/javascripts/dialog_field_refresh_spec.js | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comment 5 CFME Bot 2016-06-01 21:16:06 UTC
New commit detected on cfme/5.5.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=ac35f152bc0d946f29d1515bdadbc76d16e72b39

commit ac35f152bc0d946f29d1515bdadbc76d16e72b39
Author:     Erik Clarizio <eclarizi@redhat.com>
AuthorDate: Tue Apr 5 10:52:10 2016 -0700
Commit:     Erik Clarizio <eclarizi@redhat.com>
CommitDate: Wed May 25 13:24:49 2016 -0700

    Ensure miqJqueryRequest returns a deferred promise so that $.when works
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1339751

 app/assets/javascripts/miq_application.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comment 6 CFME Bot 2016-06-01 21:16:12 UTC
New commit detected on cfme/5.5.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=377b62a07935deeaaab6ddafbbc964884242d865

commit 377b62a07935deeaaab6ddafbbc964884242d865
Merge: 171e8d4 6e0ec16
Author:     Greg McCullough <gmccullo@redhat.com>
AuthorDate: Wed Jun 1 17:03:53 2016 -0400
Commit:     Greg McCullough <gmccullo@redhat.com>
CommitDate: Wed Jun 1 17:03:53 2016 -0400

    Merge branch 'MR-for-PR7661' into '5.5.z'
    
    Issue with auto-refresh transactions not firing after they should
    
    Was sent this issue by Jared Deubel, it appears as though a customer is having issues with concurrent transactions. We didn't have a BZ for this before, the cherry-picks were from this PR: https://github.com/ManageIQ/manageiq/pull/7661, which only has ties to a git issue and a manageiq talk topic.
    
    The cherry-picks had a few very minor conflicts that didn't even really seem like conflicts, I'm not sure why git couldn't figure it out.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1339751
    
    See merge request !952

 app/assets/javascripts/dialog_field_refresh.js     |  9 +++---
 app/assets/javascripts/miq_application.js          | 25 +++++++++------
 app/assets/javascripts/miq_ujs_bindings.js         | 36 ++++++++++++----------
 .../application_controller/dialog_runner.rb        | 11 -------
 spec/javascripts/dialog_field_refresh_spec.js      | 10 +++---
 5 files changed, 45 insertions(+), 46 deletions(-)

Comment 7 CFME Bot 2016-06-01 21:16:17 UTC
New commit detected on cfme/5.5.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=6e0ec169d19f96c37dfbbcf9f7a8d2d94b0a2a6d

commit 6e0ec169d19f96c37dfbbcf9f7a8d2d94b0a2a6d
Author:     Erik Clarizio <eclarizi@redhat.com>
AuthorDate: Thu May 26 11:36:20 2016 -0700
Commit:     Erik Clarizio <eclarizi@redhat.com>
CommitDate: Thu May 26 11:36:20 2016 -0700

    Do not attempt to use callback if it does not exist
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1339751

 app/assets/javascripts/miq_application.js | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comment 9 Milan Falešník 2016-07-15 08:10:13 UTC
AFAIU - if I create a dynamic dialog with auto refresh and I change things, the requests in the automate must not overlap, is that right?

Comment 10 eclarizi 2016-07-15 08:40:24 UTC
It's ok if the refreshes overlap, but what was happening before was that as soon as something was changed, the refresh was being triggered, and sometimes the refresh would finish before the request for the actual thing being changed finished, causing a data sync issue.

If you have something like a drop down that triggers auto-refresh and 3 other fields that respond to auto-refreshes, and you choose something from said drop down, it is expected that all 3 of the other requests execute simultaneously. However, they should all not even start to execute until after the "dialog_field_changed" request from selecting something in that drop down finishes. Does that help?

Comment 11 Milan Falešník 2016-07-15 13:14:39 UTC
So it should look something like this?:

[----] I, [2016-07-15T09:14:43.767502 #2196:b7b998]  INFO -- : Started POST "/catalog/dialog_field_changed/24?test1=dsfgsdgfewrg" for 127.0.0.1 at 2016-07-15 09:14:43 -0400
[----] I, [2016-07-15T09:14:43.770174 #2196:b7b998]  INFO -- : Processing by CatalogController#dialog_field_changed as JS
[----] I, [2016-07-15T09:14:43.770324 #2196:b7b998]  INFO -- :   Parameters: {"test1"=>"dsfgsdgfewrg", "id"=>"24"}
[----] I, [2016-07-15T09:14:43.881962 #2196:b7b998]  INFO -- : Completed 200 OK in 111ms (Views: 0.9ms | ActiveRecord: 5.8ms)
[----] I, [2016-07-15T09:14:44.056235 #2196:b7b998]  INFO -- : Started POST "/catalog/dynamic_radio_button_refresh" for 127.0.0.1 at 2016-07-15 09:14:44 -0400
[----] I, [2016-07-15T09:14:44.058644 #2196:b7b998]  INFO -- : Processing by CatalogController#dynamic_radio_button_refresh as */*
[----] I, [2016-07-15T09:14:44.058820 #2196:b7b998]  INFO -- :   Parameters: {"name"=>"test2", "checked_value"=>""}
[----] I, [2016-07-15T09:14:46.753582 #2196:b7b998]  INFO -- : Completed 200 OK in 2694ms (Views: 0.8ms | ActiveRecord: 23.6ms)
[----] I, [2016-07-15T09:14:46.780471 #2196:b7b998]  INFO -- : Started POST "/catalog/dynamic_radio_button_refresh" for 127.0.0.1 at 2016-07-15 09:14:46 -0400
[----] I, [2016-07-15T09:14:46.782936 #2196:b7b998]  INFO -- : Processing by CatalogController#dynamic_radio_button_refresh as */*
[----] I, [2016-07-15T09:14:46.783131 #2196:b7b998]  INFO -- :   Parameters: {"name"=>"test3", "checked_value"=>""}
[----] I, [2016-07-15T09:14:49.499150 #2196:b7b998]  INFO -- : Completed 200 OK in 2716ms (Views: 1.3ms | ActiveRecord: 27.0ms)
[----] I, [2016-07-15T09:14:49.524851 #2196:b7b998]  INFO -- : Started POST "/catalog/dynamic_radio_button_refresh" for 127.0.0.1 at 2016-07-15 09:14:49 -0400
[----] I, [2016-07-15T09:14:49.527032 #2196:b7b998]  INFO -- : Processing by CatalogController#dynamic_radio_button_refresh as */*
[----] I, [2016-07-15T09:14:49.527177 #2196:b7b998]  INFO -- :   Parameters: {"name"=>"test4", "checked_value"=>""}
[----] I, [2016-07-15T09:14:52.325483 #2196:b7b998]  INFO -- : Completed 200 OK in 2798ms (Views: 1.2ms | ActiveRecord: 27.0ms)

The first one (test1) is set to trigger refresh on other fields, the other three are set to auto refresh.

What worries me is taht all the 4 elements are dropdowns but the methods called are the dynamic_radio:button_refresh ... :)

Comment 12 eclarizi 2016-07-15 14:27:13 UTC
Yeah, that looks fine. I agree it's a little confusing, we should probably change the name of the action to fit better. I believe when I first started implementing dynamic dialog fields, radio buttons were one of the first ones I did, and the exact same data format gets sent for drop downs, so it was just overlooked that I forgot to change the method name.

Comment 13 Milan Falešník 2016-07-15 14:52:09 UTC
So after discussion with Eric moving to VERIFIED state.

Comment 15 errata-xmlrpc 2016-07-26 15:34:53 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-1488.html


Note You need to log in before you can comment on or make changes to this bug.