Skip to content

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

Merged
watson merged 1 commit intoelastic:7.xfrom
watson:backport/7.x/pr-59651
Mar 12, 2020
Merged

[7.x] Ensure process exits if a process warning is emitted (#59651)#59980
watson merged 1 commit intoelastic:7.xfrom
watson:backport/7.x/pr-59651

Conversation

@watson
Copy link
Copy Markdown
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
@watson watson added the backport This PR is a backport of another PR label Mar 12, 2020
@kibanamachine
Copy link
Copy Markdown
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

backport This PR is a backport of another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants