Skip to content

fs.closeSync and fs.close crash node process when fd is a random integer #37874

@zyscoder

Description

@zyscoder

What steps will reproduce the bug?

Setup a node instance,

» node

and run the following javascript code.

fs.closeSync(16)

Then an abort occurs.

How often does it reproduce? Is there a required condition?

This abort can always be triggered following the steps above.

What is the expected behavior?

If any error occurs, an exception or other similar error-reporting stuff should be thrown. There is no reason to abort the whole node process.

What do you see instead?

 » node                                                                                                                                                                                                       134 ↵ zys@zys-X299-UD4-Pro
Welcome to Node.js v14.15.1.
Type ".help" for more information.
> fs.closeSync(16);
undefined
> [1]    125036 abort (core dumped)  node

Additional information

Metadata

Metadata

Assignees

No one assigned

    Labels

    fsIssues and PRs related to the fs subsystem / file system.libuvIssues and PRs related to the libuv dependency or the uv binding.

    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