thehubbleproject / hubble-contracts

Hubble optimistic rollup
https://thehubbleproject.github.io/docs/
MIT License
133 stars 28 forks source link

Crash/exit Hubble Node process and other scripts/entrypoints on UnhandledPromiseRejections #613

Open jacque006 opened 3 years ago

jacque006 commented 3 years ago

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.

jacque006 commented 3 years ago

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