[data.search.bsearch] Forward request abortSignal to search strategy#170041
[data.search.bsearch] Forward request abortSignal to search strategy#170041lukasolson merged 30 commits intoelastic:mainfrom
Conversation
…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 <efstratia.kalafateli@elastic.co> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
src/plugins/data/server/search/strategies/ese_search/ese_search_strategy.ts
Outdated
Show resolved
Hide resolved
|
Pinging @elastic/kibana-data-discovery (Team:DataDiscovery) |
|
@elasticmachine merge upstream |
src/plugins/data/server/search/strategies/eql_search/eql_search_strategy.ts
Show resolved
Hide resolved
drewdaemon
left a comment
There was a problem hiding this comment.
Discovery owns search.
davismcphee
left a comment
There was a problem hiding this comment.
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?
src/plugins/data/server/search/strategies/eql_search/eql_search_strategy.ts
Show resolved
Hide resolved
src/plugins/data/server/search/strategies/ese_search/ese_search_strategy.ts
Outdated
Show resolved
Hide resolved
src/plugins/data/server/search/strategies/ese_search/ese_search_strategy.ts
Show resolved
Hide resolved
src/plugins/data/server/search/strategies/ese_search/ese_search_strategy.test.ts
Show resolved
Hide resolved
…to bsearch/abort-again
Added in 7fc746a |
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]
History
To update your PR or re-run it, just comment with: cc @lukasolson |
|
Should be ready for another look. |
davismcphee
left a comment
There was a problem hiding this comment.
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 👍
src/plugins/data/server/search/strategies/ese_search/ese_search_strategy.ts
Show resolved
Hide resolved
## 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
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:
For maintainers