Skip to content
This repository was archived by the owner on Aug 11, 2021. It is now read-only.
This repository was archived by the owner on Aug 11, 2021. It is now read-only.

Warning: Possible EventEmitter memory leak detected. 11 SIGINT listeners added. #11

Closed
@gschmottlach-xse

Description

@gschmottlach-xse

This error occurred using npm v5.6.0 in a module that had a postinstall life-cycle step. Consistently I would get this error indicating there are too many process.on('SIGINT', ...) event registrations that aren't being removed. If I remove my postinstall step the error disappeared. If I substituted my postinstall step with an empty script I still received this error.

Digging into:

https://github.com/npm/npm/blob/latest/node_modules/npm-lifecycle/index.js

On line 297 the SIGINT event handler is registered:

process.once('SIGINT', procInterupt)

But on line 318 it removes a listener function for the wrong signal:

process.removeListener('SIGTERM', procInterupt)

Clearly, this is a mistake. It should instead be:

process.removeListener('SIGINT', procInterupt)

I made this change to my local copy of npm and verified that I know longer receive the warning. The SIGINT event function is now properly being removed during the npm lifecycle processing.

Let me know if you have any further questions . . .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions