-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Improve state sync error handling #74264
Improve state sync error handling #74264
Conversation
…tate-sync-error-handling
Pinging @elastic/kibana-app-arch (Team:AppArch) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code changes LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this on dashboard and it seems like I get a toast even if I open the tab in the same window. Shouldn't it use the localstorage and retain the hash when doing this?
It's also broken on 7.8 so not blocking for this PR but if we can't fix it here I will open a new issue for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maps changes lgtm
code review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Monitoring changes look good 👍
@elasticmachine merge upstream |
@flash1293, it uses session storage. |
Thanks for confirming @Dosant . In this case everything works as expected |
@elasticmachine merge upstream |
we should backport this to 7.9 |
…sant/kibana into dev/improve-state-sync-error-handling
💚 Build SucceededBuild metrics@kbn/optimizer bundle module count
async chunks size
page load bundle size
History
To update your PR or re-run it, just comment with: |
Fixes elastic#71461 regression since 7.7 New state syncing utils didn't properly handle errors, Errors happening during URL parsing or writing wasn't handled, so state syncing could stop or in worth case blow out. (see elastic#71461) There are not much scenarios where missing proper error handling could really impact users, except the one described in elastic#71461: Kibana users state:storeInSessionStorage Users often intuitively share hashed dashboard urls directly When someone opens those urls - there is a blank screen with warning In 7.6 - dashboard would still load with default state. Since 7.7 these still could be achieved by removing query params for URL, but it is not obvious for regular users. This PR makes sure that behaviour is similar to one we had before 7.7. Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Fixes elastic#71461 regression since 7.7 New state syncing utils didn't properly handle errors, Errors happening during URL parsing or writing wasn't handled, so state syncing could stop or in worth case blow out. (see elastic#71461) There are not much scenarios where missing proper error handling could really impact users, except the one described in elastic#71461: Kibana users state:storeInSessionStorage Users often intuitively share hashed dashboard urls directly When someone opens those urls - there is a blank screen with warning In 7.6 - dashboard would still load with default state. Since 7.7 these still could be achieved by removing query params for URL, but it is not obvious for regular users. This PR makes sure that behaviour is similar to one we had before 7.7. Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> # Conflicts: # src/plugins/timelion/public/app.js # x-pack/plugins/lens/public/app_plugin/app.tsx
Fixes #71461 regression since 7.7 New state syncing utils didn't properly handle errors, Errors happening during URL parsing or writing wasn't handled, so state syncing could stop or in worth case blow out. (see #71461) There are not much scenarios where missing proper error handling could really impact users, except the one described in #71461: Kibana users state:storeInSessionStorage Users often intuitively share hashed dashboard urls directly When someone opens those urls - there is a blank screen with warning In 7.6 - dashboard would still load with default state. Since 7.7 these still could be achieved by removing query params for URL, but it is not obvious for regular users. This PR makes sure that behaviour is similar to one we had before 7.7. Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
4 similar comments
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code LGTM
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
5 similar comments
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync. |
Summary
Fixes #71461 regression since 7.7
New state syncing utils didn't properly handle errors,
Errors happening during URL parsing or writing wasn't handled, so state syncing could stop or in worth case blow out. (see #71461)
There are not much scenarios where missing proper error handling could really impact users, except the one described in #71461:
state:storeInSessionStorage
In 7.6 - dashboard would still load with default state.
Since 7.7 these still could be achieved by removing query params for URL, but it is not obvious for regular users.
This PR makes sure that behaviour is similar to one we had before 7.7.
How to test
Simplest way to test is to repeat real user flow:
state:storeInSessionStorage
Please note
When testing you may notice multiple warnings,
This is a separate common issue which needs attention:
tracked here: #67270
Implementation details
After reviewing all state syncing usages, I decided to add error handling level not on a
state_sync
util level itself, but on storage level instead. You could view documentation diffs for insights.The reason is that
kbnUrlStateStorage
is used both by applications code directly and indirectly bystate_sync
utils. If I'd add error handling apis onstate_sync
level, then error handling in application code would be more tedious: both had to make surestate_sync
is setup to handle errors, but also every usage ofkbnUrlStateStorage
api is wrapped in try / catch.Release notes
Fix apps break on unrestorable session state in URL
Checklist