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

When instrumenting Kibana, aborted requests crash the server #52617

Closed
dgieselaar opened this issue Dec 10, 2019 · 3 comments · Fixed by #74658
Closed

When instrumenting Kibana, aborted requests crash the server #52617

dgieselaar opened this issue Dec 10, 2019 · 3 comments · Fixed by #74658
Assignees
Labels
bug Fixes for quality problems that affect the customer experience Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc

Comments

@dgieselaar
Copy link
Member

Kibana version:

7.6

Describe the bug:

Our cloud instance has crashed several times since instrumenting Kibana with the APM agent:

TypeError: request.abort is not a function
    at AbortSignal.options.signal.addEventListener (/home/apm/elastic/kibana/src/core/server/elasticsearch/cluster_client.ts:67:19)
    at Timeout._onTimeout (/home/apm/elastic/kibana/node_modules/abortcontroller-polyfill/dist/cjs-ponyfill.js:153:27)
    at ontimeout (timers.js:436:11)
    at tryOnTimeout (timers.js:300:5)
    at listOnTimeout (timers.js:263:5)
    at Timer.processTimers (timers.js:223:10)
Sending error to Elastic APM { id: '82c0025cbfbe1e4359e3da795e16758c' }

request is a promise returned by the Elasticsearch client. abort() will be called when for some reason the consumer wants to abort the request (for instance, when the request is taking too long). However, abort() is no longer available when the APM agent has instrumented Kibana, perhaps because it intercepts the promise but does not copy over the abort method.

Steps to reproduce:

  1. Activate the APM agent by creating config/apm.dev.js:
module.exports = { active: true };
  1. add the following lines to src/legacy/core_plugins/elasticsearch/lib/abortable_request_handler.js:
setTimeout(() => {
  console.log('aborting')
  controller.abort();
}, 100);

This will abort a request to the ES proxy endpoint (/elasticsearch/_search) after 100ms.

  1. Then, go to Management > Index Patterns > Create index pattern. This should then call the ES proxy endpoint and crash Kibana.

Expected behavior:

Kibana should not crash when a request times out for whatever reason.

Any additional context:

The impact will be small, because users will not have instrumented Kibana with the APM agent, and it only happens on long-running requests or aborts.

@sqren @watson

@watson watson self-assigned this Dec 10, 2019
@azasypkin azasypkin added bug Fixes for quality problems that affect the customer experience Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc labels Dec 11, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-platform (Team:Platform)

@pgayvallet
Copy link
Contributor

@watson any progress on elastic/apm-agent-nodejs#1566?

@watson
Copy link
Contributor

watson commented May 27, 2020

Unfortunately not, sorry. It's on my todo-list. Here's the PR's that I've made to fix it, but I got stuck on a failing test and never got any further. If anybody has time to help I'd be happy to review:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants