Skip to content

Memory Leak caused by unique Winston categories #141

Open
@uPaymeiFixit

Description

@uPaymeiFixit

When calling winston.loggers.get("category1"), if a logger with the category of "category1" is not found, it will automatically be created.

This means if we run the following code we will create 1000 separate Winston loggers.

for (let i = 0; i < 1000; i++) {
  winston.loggers.get("category" + i);
}

Similarly, when any endpoint is called, the following code is run, resulting in a new Winston logger being created.

var loggerCategoryRandomiser = Math.floor(Math.random() * (1000000000 - 100 + 1)) + 100;

To my knowledge, this logger is never closed, and so new Winston loggers pile up on the heap.

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