Skip to content
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

[Controls] Fix Initialization Race Condition #143220

Merged
merged 4 commits into from
Oct 12, 2022

Conversation

ThomThomson
Copy link
Contributor

@ThomThomson ThomThomson commented Oct 12, 2022

Summary

Fixes a race condition introduced in #142868 by forcing the dashboard container to initialize after the control group is finished loading.

Previously, the dashboard viewport and the container would wait until all of the Control children had finished loading before rendering, but they would not wait for the control group to finish loading before starting to initialize embeddable children.

This could cause a race condition in cases when the Dashboard's panels loaded too quickly to get the initial filters from the control group.

Fixes #142912
Fixes #142913

Flaky test runner

@ThomThomson ThomThomson added Feature:Dashboard Dashboard related features Feature:Input Control Input controls visualization Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas loe:small Small Level of Effort release_note:skip Skip the PR/issue when compiling release notes impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. Project:Controls labels Oct 12, 2022
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
controls 204 205 +1

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
controls 459.2KB 459.5KB +313.0B
dashboard 422.7KB 422.3KB -332.0B
total -19.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
dashboard 41.0KB 41.2KB +174.0B
Unknown metric groups

API count

id before after diff
controls 212 213 +1

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@ThomThomson ThomThomson marked this pull request as ready for review October 12, 2022 20:05
@ThomThomson ThomThomson requested a review from a team as a code owner October 12, 2022 20:05
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-presentation (Team:Presentation)

Copy link
Contributor

@Heenawter Heenawter left a comment

Choose a reason for hiding this comment

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

Code review + tested locally:

  1. Throttled the network connection and ensured that the control group fully loaded before the dashboard container did
  2. Console logged once the control group children were all marked as ready, the control group was initialized, and the dashboard container was done loading - ensured that these logs followed the expected order under various conditions.
  3. Followed a dashboard-to-dashboard drilldown with control selections and everything worked as expected.

Everything worked great 👍 What a nasty bug!

@ThomThomson ThomThomson added the backport:prev-minor Backport to (8.x) the previous minor version (i.e. one version back from main) label Oct 12, 2022
@ThomThomson ThomThomson merged commit 702827b into elastic:main Oct 12, 2022
@kibanamachine
Copy link
Contributor

💔 All backports failed

Status Branch Result
8.5 Backport failed because of merge conflicts

Manual backport

To create the backport manually run:

node scripts/backport --pr 143220

Questions ?

Please refer to the Backport tool documentation

@ThomThomson
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
8.5

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

ThomThomson added a commit to ThomThomson/kibana that referenced this pull request Oct 12, 2022
* Fix Initialization Race Condition

(cherry picked from commit 702827b)

# Conflicts:
#	src/plugins/dashboard/public/application/embeddable/dashboard_container_factory.tsx
#	x-pack/test/functional/apps/dashboard/group3/drilldowns/dashboard_to_dashboard_drilldown.ts
ThomThomson added a commit that referenced this pull request Oct 12, 2022
* Fix Initialization Race Condition

(cherry picked from commit 702827b)

# Conflicts:
#	src/plugins/dashboard/public/application/embeddable/dashboard_container_factory.tsx
#	x-pack/test/functional/apps/dashboard/group3/drilldowns/dashboard_to_dashboard_drilldown.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment