Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

feat(make-promises-safe): treat unhandledRejection as uncaught exception #174

Merged
merged 2 commits into from
Jun 10, 2020

Conversation

JAdshead
Copy link
Contributor

@JAdshead JAdshead commented Jun 1, 2020

Description

Installed and imported make-promises-safe

Motivation and Context

Node does not crash if there is an 'unhandledRejection', i.e. a Promise without a .catch() handler. This causes a memory leak, make-promises-safe installs an process.on('unhandledRejection') handler that prints the stacktrace and exits the process with an exit code of 1, just like any uncaught exception.

How Has This Been Tested?

Locally running one-app serving frank-lloyd-root. Unit and integration tests.

Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (adding or updating documentation)
  • Dependency update

Checklist:

  • My change requires a change to the documentation and I have updated the documentation accordingly.
  • These changes should be applied to a maintenance branch.
  • This change requires cross browser checks.
  • Performance tests should be ran against the server prior to merging.
  • This change impacts caching for client browsers.
  • This change impacts HTTP headers.
  • This change adds additional environment variable requirements for One App users.
  • I have added the Apache 2.0 license header to any new files created.

What is the Impact to Developers Using One App?

None

@JAdshead JAdshead requested review from a team as code owners June 1, 2020 23:48
@oneamexbot
Copy link
Contributor

oneamexbot commented Jun 9, 2020

📊 Bundle Size Report

file name size on disk gzip
app.js 104.5KB 28.7KB
runtime.js 15KB 5.4KB
vendors.js 116.6KB 36.3KB
app~vendors.js 432.4KB 112.2KB
service-worker-client.js 16.9KB 5.2KB
legacy/app.js 113.4KB 30.9KB
legacy/runtime.js 15KB 5.4KB
legacy/vendors.js 163.1KB 44.7KB
legacy/app~vendors.js 441KB 114.4KB
legacy/service-worker-client.js 17.4KB 5.4KB

Generated by 🚫 dangerJS against 85c69f4

@@ -17,6 +17,7 @@
import 'core-js/stable';
import 'regenerator-runtime/runtime';
import 'cross-fetch/polyfill';
import 'make-promises-safe';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool that works just by importing the module!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This basically adds a event handler on unhandledRejection that calls process.exit(1).

Copy link
Contributor

@infoxicator infoxicator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really cool! looking forward to the performance improvements and getting rid of those errors when force closing one-app-runner...

@JAdshead JAdshead merged commit 5fe0245 into master Jun 10, 2020
@JAdshead JAdshead deleted the feat/make-promises-safe branch June 10, 2020 16:02
@JAdshead JAdshead added the enhancement New feature or request label Jun 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants