Skip to content

Possible Memory Leak - heapdumps show continuous growth in compiled code being retained by dummy job #3040

Open
@garrettg123

Description

@garrettg123

Version

v5.39.1

Platform

NodeJS

What happened?

As seen in the heap dump comparison after ~100k dummy job completions, there is compiled code that looks like Redis commands being retained. Tested with concurrency = 1 and 5, limited to 1 or 100 per second.
Image

How to reproduce.

new Worker(
      myQueue,
      job => {
        // empty
      },
      {
        connection: new IORedis({
      host: env.REDIS_HOST || 'localhost',
      port: Number(env.REDIS_PORT) || 6379,
      maxRetriesPerRequest: null,
    }),
        concurrency: 5,
        limiter: {
          max: 100,
          duration: 1000,
        },
      }
    )

Relevant log output

When tracking metrics, it appears that only 10% get drained:

  Worker stats: {
    workers: 1,
    active: 157430,
    progress: 0,
    completed: 157430,
    stalled: 0,
    failed: 0,
    errored: 0,
    drained: 1575,
  }


This was calculated using the handlers:

worker.on('completed', job => {
  WORKER_STATS.completed++
})

worker.on('failed', (job, error) => {
  WORKER_STATS.failed++
})

worker.on('error', error => {
  WORKER_STATS.errored++
})

worker.on('progress', (job, progress) => {
  WORKER_STATS.progress++
})

worker.on('stalled', job => {
  WORKER_STATS.stalled++
})

worker.on('active', job => {
  WORKER_STATS.active++
})

worker.on('drained', () => {
  WORKER_STATS.drained++
})

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions