node-redis icon indicating copy to clipboard operation
node-redis copied to clipboard

Memory Leak when using brpop

Open rahulwinzo opened this issue 6 years ago • 1 comments

I've this piece of code which is causing memory leaks.

var redis = require("redis");
var util = require("util");

client = redis.createClient();

var brpopAsync = util.promisify(client.brpop).bind(client);

setInterval(() => {
  process.nextTick( async () => {
   const data = await brpopAsync('testlist', 5);
 }) 
}, 200);

I inspected the code using chrome debugger and saw that this indeed is a closure leak. However, if I replace the brpop with rpop I don't get any memory leak. I'm trying to understand what's the issue with using brpop. How can brpop be used efficiently.


Environment

  • Node.js Version: v10.16.0
  • Redis Version: 4.0.9
  • Platform: Mac OSX, Amazon Linux

rahulwinzo avatar Apr 09 '20 17:04 rahulwinzo

any updates on this?

fsfarah avatar Jan 17 '21 18:01 fsfarah