Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

unhandledRejection can cause file descriptor exhaustion #29

@mcollina

Description

@mcollina

Seeing an unhandledRejection in the output of a Node.js process is a code smell that a bug and a potential security vulnerability are within the codebase. It can trigger a very similar behavior of #28.
I have seen this happening, mainly because a lot of promise users thinks the error model of Node.js is similar to the one of the browser, and a missing error path will not cause problems down the road. This is very different in Node.js itself, because an error that is not handled properly can disrupt thousands of users.

A full example is available at https://github.com/mcollina/make-promises-safe#the-problem.

My solution is to always attach an unhandledRejection  handler which crashes the process.
This is very debated topic in the Node.js ecosystem, because it prevents a very common pattern of Promises, i.e. "fire and forget".

This is my opinion, and I added this issue because I think we should discuss about it.

cc @MylesBorins

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions