Skip to content

Fix auto refresh not working after page reload#26088

Merged
timroes merged 2 commits intoelastic:masterfrom
timroes:fix-auto-refresh
Nov 28, 2018
Merged

Fix auto refresh not working after page reload#26088
timroes merged 2 commits intoelastic:masterfrom
timroes:fix-auto-refresh

Conversation

@timroes
Copy link
Contributor

@timroes timroes commented Nov 22, 2018

Summary

Fixes #25987

Auto refresh happened to work only by some timing coincident. The addSetupWork in timefilter has to be run after the courier service was constructed (and could register its listener for that). That's in 6.5 no longer the case. I can't pinpoint what PR actually broke this. Since it's some timing issue it could potentially have been anything around routing work, some Angular removal or similar.

We now properly also set the searchPoll timeout (which triggers the whole refresh process), when courier starts up after that setup work, i.e. always initially get the refresh interval and set it to searchPoll and not only if we see a change event.

Timefilter issue

After fixing that the test failure revealed another issue, that I am fixing with this PR. Currently the timefilter to work properly requires some setup work, that happens during uiRoutes.addSetupWork, which not necessarily run in all plugins (also see #19110). In some cases you don't want to run it, since you are not planning on using the globalState at all.

In those cases, we would read out the timepicker:refreshIntervalDefaults config which defaults to { value: 0, pause: false } and just use this. This default config will cause courier to hang, since it now schedules another request for each 0ms delay, so we're kind of stuck in an endless loop blocking every execution slot with a new request. If the route setup work runs, this would never happen, since we are calling setRefreshInterval with (if nothing else is that) this value. This method actually makes sure to set pause to true if value is <= 0.

I modified the timefilter slightly so that it always (no matter if route setup work is used or not) calls this method, and just make sure that the update event isn't emitted if there has been no previous refresh interval set.

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

@timroes timroes added bug Fixes for quality problems that affect the customer experience Feature:Search Querying infrastructure in Kibana release_note:fix v7.0.0 Team:Visualizations Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// v6.6.0 v6.5.2 labels Nov 22, 2018
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app

@elasticmachine
Copy link
Contributor

💔 Build Failed

@timroes
Copy link
Contributor Author

timroes commented Nov 22, 2018

Jenkins, test this - test timed out

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@timroes timroes requested a review from Bargs November 23, 2018 17:38
Copy link
Contributor

@markov00 markov00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM. Tested on chrome OSX, this correctly fix the issue

Copy link
Contributor

@nreese nreese left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm
code review

Copy link
Contributor

@lukeelmers lukeelmers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code LGTM. tested and verified on osx chrome, safari, firefox

@timroes timroes merged commit 7f274ef into elastic:master Nov 28, 2018
@timroes timroes deleted the fix-auto-refresh branch November 28, 2018 18:43
timroes added a commit to timroes/kibana that referenced this pull request Nov 28, 2018
* Fix auto refresh after page reload

* Fix timefilter initial state
timroes added a commit to timroes/kibana that referenced this pull request Nov 28, 2018
* Fix auto refresh after page reload

* Fix timefilter initial state
@stacey-gammon
Copy link

@LeeDr - Do you object to me marking this a blocker and backporting to 6.5? Technically it will cause invalid data to display - if the user has auto refresh of 5 seconds and now to now-15m they will think they are seeing updated information but because auto refresh is broken after page reload, their data will actually be stale.

If you do not object, @timroes has a PR ready to be merged here: https://kibana-ci.elastic.co/job/elastic+kibana+pull-request/1572/

timroes added a commit that referenced this pull request Nov 28, 2018
* Fix auto refresh after page reload

* Fix timefilter initial state
timroes added a commit that referenced this pull request Nov 29, 2018
* Fix auto refresh after page reload

* Fix timefilter initial state
@cowst
Copy link

cowst commented Apr 11, 2019

Being tagged 6.5.2, does it mean 6.5.4 should contain the fix?
Do you know if this applies also to managed Elasticsearch/Kibana on AWS?

Because 6.5.4 there is still affected by the bug.

@timroes
Copy link
Contributor Author

timroes commented Apr 12, 2019

Hi @cowst,

yeah this was released in the 6.5.2 release from our side. I am not sure if AWS does specific path picking on patch releases. Could you please download the following two files:

  • https://[your-kibana-host]/bundles/commons.bundle.js
  • https://[your-kibana-host]/bundles/kibana.bundle.js

Those should be the JavaScript bundles for your Kibana instance (no private information should be in that). If you could upload them here, I can check if those contain this above fix.

Cheers,
Tim

@cowst
Copy link

cowst commented Apr 12, 2019

I think I see the changes in commons bundle.
Don't know what should end up in kibana bundle though.

kibana.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocker bug Fixes for quality problems that affect the customer experience Feature:Search Querying infrastructure in Kibana release_note:fix Team:Visualizations Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// v6.5.2 v6.6.0 v7.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto refresh stops working after refreshing page in browser or sharing dashboard-url in version 6.5

7 participants