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

[7.x] Ensure process exits if a process warning is emitted (#59651) #59980

Merged
merged 1 commit into from
Mar 12, 2020

Conversation

watson
Copy link
Contributor

@watson watson commented Mar 12, 2020

Backports the following commits to 7.x:

Crash Kibana in dev/CI if a process warning is detected. This does not
influence how Kibana behaves in production when run via `./bin/kibana`
as there the `--no-warnings` flag is used. We will detect this flag and
as a result, disable this behavior.

Previously we used the flags `--trace-warnings --throw-deprecation` when
you started Kibana via `yarn start` and we used `--throw-deprecation` in
CI. This meant that we would only crash on deprecation warnings and log
a stack trace for all other types of warnings.

There were a couple of drawbacks to this approach:

1. If the deprecated API was called in a place enclosed in a try-catch
   (or inside of a Promise or an async/await context), the throw would
   be caught and the program would not crash.

2. If you ran `./scripts/kibana` directly instead of running `yarn
   start`, you would not get these flags automatically.

3. If you ran any of our tests locally you would not get the standard CI
   flags. This meant something that might seem to pass locally would not
   pass in CI.

This commit changes this behavior by ensuring:

- That we always crash - no matter if the offending code is surrounded
  by a try-catch (etc).

- That you always get the same behavior whether you run `yarn start` or
  `./scripts/kibana`.

- That you always get the same behavior in CI or if you run individual
  tests locally.

Furthermore, we now crash for all types of warnings - not only
deprecation warnings (except `MaxListenersExceededWarning`).

Closes elastic#59646
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

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

@watson watson merged commit 9fb405f into elastic:7.x Mar 12, 2020
@watson watson deleted the backport/7.x/pr-59651 branch March 12, 2020 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants