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

[data.search.bsearch] Forward request abortSignal to search strategy #170041

Merged
merged 30 commits into from
Nov 10, 2023

Conversation

lukasolson
Copy link
Member

@lukasolson lukasolson commented Oct 27, 2023

Summary

Attempt to resurrect #169041.

Previously flaky tests:

Checklist

Delete any items that are not applicable to this PR.

Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.

When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:

Risk Probability Severity Mitigation/Notes
Multiple Spaces—unexpected behavior in non-default Kibana Space. Low High Integration tests will verify that all features are still supported in non-default Kibana Space and when user switches between spaces.
Multiple nodes—Elasticsearch polling might have race conditions when multiple Kibana nodes are polling for the same tasks. High Low Tasks are idempotent, so executing them multiple times will not result in logical error, but will degrade performance. To test for this case we add plenty of unit tests around this logic and document manual testing procedure.
Code should gracefully handle cases when feature X or plugin Y are disabled. Medium High Unit tests will verify that any feature flag or plugin combination still results in our service operational.
See more potential risk examples

For maintainers

lukasolson and others added 2 commits October 27, 2023 08:13
…lastic#169041)

## Summary

Creates an `abortSignal` from the request disconnected event that is
forwarded to the search strategy. In practice this means that when a
bsearch call is disconnected (either due to client disconnect or server
timeout) the corresponding call to ES is also cancelled.

### Checklist

Delete any items that are not applicable to this PR.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))
- [ ] Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))
- [ ] This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)

---------

Co-authored-by: Stratoula Kalafateli <[email protected]>
Co-authored-by: Kibana Machine <[email protected]>
@lukasolson lukasolson self-assigned this Oct 27, 2023
@lukasolson lukasolson added Feature:Search Querying infrastructure in Kibana Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. v8.11.0 v8.12.0 v8.11.1 labels Oct 29, 2023
@lukasolson lukasolson marked this pull request as ready for review October 29, 2023 06:13
@lukasolson lukasolson requested review from a team as code owners October 29, 2023 06:13
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)

@lukasolson
Copy link
Member Author

@elasticmachine merge upstream

@lukasolson lukasolson added the release_note:skip Skip the PR/issue when compiling release notes label Oct 30, 2023
Copy link
Contributor

@drewdaemon drewdaemon left a comment

Choose a reason for hiding this comment

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

Discovery owns search.

Copy link
Contributor

@davismcphee davismcphee left a comment

Choose a reason for hiding this comment

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

I left some feedback in the comments, but overall the changes seem good. My only other question is are we able to add functional test coverage for these changes, especially around the scenario that led to the crashes in CI? Maybe through API integration tests or similar?

@lukasolson
Copy link
Member Author

especially around the scenario that led to the crashes in CI?

Added in 7fc746a

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

✅ unchanged

History

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

cc @lukasolson

@lukasolson
Copy link
Member Author

Should be ready for another look.

Copy link
Contributor

@davismcphee davismcphee left a comment

Choose a reason for hiding this comment

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

Thanks for all the work on this, and especially all the tests! The integration test looks like it does a good job covering the issue we were running into. For good measure I started a flaky test run on some of the FTR configs that were failing last time and the config for the new integration test: https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3966.

I'm going to approve now though since it LGTM, and I think we should be good to merge as long as the test runs pass 👍

@lukasolson lukasolson merged commit b84881a into elastic:main Nov 10, 2023
29 checks passed
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Nov 10, 2023
lukasolson added a commit that referenced this pull request May 1, 2024
## Summary

Resolves #168957.

It turns out the underlying issue was resolved in
#170041 (unhandled errors when
deleting not being handled). However this still left it up to consumers
of `pollSearch` to be 100% sure they weren't leaking unhandled promise
rejections. This adds code directly to `pollSearch` that will handle
rejections if they aren't handled in the calling code. It also adds
tests to consumers of `pollSearch` to make sure they don't barf in the
case that the `cancel` function errors.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Search Querying infrastructure in Kibana release_note:skip Skip the PR/issue when compiling release notes Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. v8.12.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants