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

[Ingest Manager] POST /setup crashes Kibana with Unhandled Promise rejection #73997

Closed
jfsiii opened this issue Jul 31, 2020 · 5 comments · Fixed by #74300
Closed

[Ingest Manager] POST /setup crashes Kibana with Unhandled Promise rejection #73997

jfsiii opened this issue Jul 31, 2020 · 5 comments · Fixed by #74300
Assignees
Labels
bug Fixes for quality problems that affect the customer experience Team:Fleet Team label for Observability Data Collection Fleet team v7.9.0 v7.10.0 v8.0.0

Comments

@jfsiii
Copy link
Contributor

jfsiii commented Jul 31, 2020

Steps to reproduce

  1. Start Kibana with the registry unavailable. e.g. use xpack.ingestManager.registryUrl flag to set it to an "bad" address or something like browser or networks tools to block traffic to https://epr.elastic.co/
    • custom registry is Gold+ so start ES in one terminal w/ yarn es snapshot --license=trial -E xpack.security.authc.api_key.enabled=true
    • Kibana in another with yarn start --no-base-path --xpack.ingestManager.enabled=true --xpack.ingestManager.registryUrl=http://localhost:9999
  2. Visit http://localhost:5601/app/ingestManager in the browser or run curl -X POST 'http://localhost:5601/api/ingest_manager/setup' -H 'kbn-xsrf: <string>' --user elastic:changeme
  3. Observe Kibana crash with
Unhandled Promise rejection detected:

{ RegistryError: Error connecting to package registry at http://localhost:9999/search?package=endpoint&internal=true&experimental=true: request to http://localhost:9999/search?package=endpoint&internal=true&experimental=true failed, reason: connect ECONNREFUSED 127.0.0.1:9999
    at getResponse (/Users/jfsiii/work/kibana/x-pack/plugins/ingest_manager/server/services/epm/registry/requests.ts:22:11)
    at process._tickCallback (internal/process/next_tick.js:68:7) name: 'RegistryError' }

Terminating process...
 server crashed  with status code 1

Notes

Not all Ingest UI routes/views were crashing. Other EPM API requests seem to work as expected before opening UI

> curl  http://localhost:5601/api/ingest_manager/epm/categories --user elastic:changeme
{"statusCode":500,"error":"Internal Server Error","message":"Error connecting to package registry at http://localhost:9999/categories: request to http://localhost:9999/categories failed, reason: connect ECONNREFUSED 127.0.0.1:9999"}

>  curl  http://localhost:5601/api/ingest_manager/epm/packages/nginx-0.1.2 --user elastic:changeme
{"statusCode":500,"error":"Internal Server Error","message":"Error connecting to package registry at http://localhost:9999/package/nginx/0.1.2: request to http://localhost:9999/package/nginx/0.1.2 failed, reason: connect ECONNREFUSED 127.0.0.1:9999"}

> curl  http://localhost:5601/api/ingest_manager/epm/packages --user elastic:changeme
{"statusCode":500,"error":"Internal Server Error","message":"Error connecting to package registry at http://localhost:9999/search: request to http://localhost:9999/search failed, reason: connect ECONNREFUSED 127.0.0.1:9999"}
@jfsiii jfsiii added bug Fixes for quality problems that affect the customer experience v8.0.0 v7.10.0 Team:Fleet Team label for Observability Data Collection Fleet team labels Jul 31, 2020
@jfsiii jfsiii self-assigned this Jul 31, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/ingest-management (Team:Ingest Management)

@jfsiii
Copy link
Contributor Author

jfsiii commented Jul 31, 2020

Looking at the network tab there was a 500 POST /setup. I see where the failure is happening and am working on a branch now.

@jfsiii
Copy link
Contributor Author

jfsiii commented Jul 31, 2020

@ruflin
Copy link
Member

ruflin commented Aug 3, 2020

@jfsiii Thanks for investigating. We should also try to get this into 7.9.0 or 7.9.1 to make sure in case a 7.9 registry is not available one day, KB does not crash.

@ruflin ruflin added the v7.9.0 label Aug 3, 2020
@jfsiii
Copy link
Contributor Author

jfsiii commented Aug 3, 2020

I found a fix jfsiii@39f6320 and will now clean up the console.logs and add test(s). I might close this and create a new PR.

a few cURL calls to POST /setup which fail w/500 502 as expected
± ~/work/kibana [73997-crash-on-setup-without-registry @ 39f6320] ✓ ‣ curl -X POST 'http://localhost:5601/api/ingest_manager/setup' -H 'kbn-xsrf: <string>' --user elastic:changeme
{"statusCode":502,"error":"Bad Gateway","message":"Error connecting to package registry at http://localhost:9999/search?package=system&internal=true&experimental=true: request to http://localhost:9999/search?package=system&internal=true&experimental=true failed, reason: connect ECONNREFUSED 127.0.0.1:9999"}^[[A
± ~/work/kibana [73997-crash-on-setup-without-registry @ 39f6320] ✓ ‣ curl -X POST 'http://localhost:5601/api/ingest_manager/setup' -H 'kbn-xsrf: <string>' --user elastic:changeme
{"statusCode":502,"error":"Bad Gateway","message":"Error connecting to package registry at http://localhost:9999/search?package=system&internal=true&experimental=true: request to http://localhost:9999/search?package=system&internal=true&experimental=true failed, reason: connect ECONNREFUSED 127.0.0.1:9999"}
± ~/work/kibana [73997-crash-on-setup-without-registry @ 39f6320] ✓ ‣ curl -X POST 'http://localhost:5601/api/ingest_manager/setup' -H 'kbn-xsrf: <string>' --user elastic:changeme
{"statusCode":502,"error":"Bad Gateway","message":"Error connecting to package registry at http://localhost:9999/search?package=system&internal=true&experimental=true: request to http://localhost:9999/search?package=system&internal=true&experimental=true failed, reason: connect ECONNREFUSED 127.0.0.1:9999"}
± ~/work/kibana [73997-crash-on-setup-without-registry @ 39f6320] ✓ ‣
the logging from those calls
handler try await setupIngestManager
setupIngestManager
handler catch { RegistryError: Error connecting to package registry at http://localhost:9999/search?package=system&internal=true&experimental=true: request to http://localhost:9999/search?package=system&internal=true&experimental=true failed, reason: connect ECONNREFUSED 127.0.0.1:9999
    at getResponse (/Users/jfsiii/work/kibana/x-pack/plugins/ingest_manager/server/services/epm/registry/requests.ts:26:11)
    at process._tickCallback (internal/process/next_tick.js:68:7) name: 'RegistryError' }
server    log   [15:06:22.313] [error][ingestManager][plugins] Error connecting to package registry at http://localhost:9999/search?package=system&internal=true&experimental=true: request to http://localhost:9999/search?package=system&internal=true&experimental=true failed, reason: connect ECONNREFUSED 127.0.0.1:9999
exit A
handler try await setupIngestManager
setupIngestManager
handler catch { RegistryError: Error connecting to package registry at http://localhost:9999/search?package=system&internal=true&experimental=true: request to http://localhost:9999/search?package=system&internal=true&experimental=true failed, reason: connect ECONNREFUSED 127.0.0.1:9999
    at getResponse (/Users/jfsiii/work/kibana/x-pack/plugins/ingest_manager/server/services/epm/registry/requests.ts:26:11)
    at process._tickCallback (internal/process/next_tick.js:68:7) name: 'RegistryError' }
server    log   [15:06:23.531] [error][ingestManager][plugins] Error connecting to package registry at http://localhost:9999/search?package=system&internal=true&experimental=true: request to http://localhost:9999/search?package=system&internal=true&experimental=true failed, reason: connect ECONNREFUSED 127.0.0.1:9999
exit A
handler try await setupIngestManager
setupIngestManager
handler catch { RegistryError: Error connecting to package registry at http://localhost:9999/search?package=system&internal=true&experimental=true: request to http://localhost:9999/search?package=system&internal=true&experimental=true failed, reason: connect ECONNREFUSED 127.0.0.1:9999
    at getResponse (/Users/jfsiii/work/kibana/x-pack/plugins/ingest_manager/server/services/epm/registry/requests.ts:26:11)
    at process._tickCallback (internal/process/next_tick.js:68:7) name: 'RegistryError' }
server    log   [15:06:24.594] [error][ingestManager][plugins] Error connecting to package registry at http://localhost:9999/search?package=system&internal=true&experimental=true: request to http://localhost:9999/search?package=system&internal=true&experimental=true failed, reason: connect ECONNREFUSED 127.0.0.1:9999
exit A

@jfsiii jfsiii changed the title [Ingest Manager] UI views can crash Kibana with Unhandled Promise rejection [Ingest Manager] POST /setup crashes Kibana if any errors in setupIngestManager Aug 4, 2020
@jfsiii jfsiii changed the title [Ingest Manager] POST /setup crashes Kibana if any errors in setupIngestManager [Ingest Manager] POST /setup crashes Kibana with Unhandled Promise rejection Aug 4, 2020
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:Fleet Team label for Observability Data Collection Fleet team v7.9.0 v7.10.0 v8.0.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants