hubble-contracts
hubble-contracts copied to clipboard
Crash/exit Hubble Node process and other scripts/entrypoints on UnhandledPromiseRejections
Problem
When an unhandled promise rejection occurs in the Hubble Node process (and likely any of our scripts/other entry points), a warning is logged out but does not prevent the process from continuing, such as in https://github.com/thehubbleproject/hubble-contracts/issues/612 . This can lead to suppression of critical bugs/issues.
Solution
Set NodeJS --unhandled-rejections=strict to exit node process when an unhandled promise rejection occurs. We should do this in the Docker image CMD
line, and the numerous spots where ts-node
is called. Ideally this can be done in package.json
, tsconfig.json
, or some other config file.
Consider also crashing the node after n failed ETH provider re-connection attempts, or a duration of failed re-connections https://github.com/thehubbleproject/hubble-contracts/blob/master/ts/client/node.ts#L43-L45