You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Create separate clients for pub/sub and regular operations
const redis = new Redis(redisConfig);
const publisher = new Redis(redisConfig);
const subscriber = new Redis(redisConfig);
here are a few questions to understand the problem better:
Which version of ioredis shows this symptom?
It seems that your code above does initialize a publisher and a subscriber, but it doesn't actually publish messages, subscribe to messages or process any messages. Why is that?
What do you mean by 'the backend gets crashed'? Do you mean that you kill the Redis server?
How did you measure the memory consumption in order to identify the potential leak?
Could you please provide step-by-step instructions that help us reproducing the issue?
In above function when mine data is large around 3000 to 4000 in length and when i execute this function frequently every second data memory reference never get clears thus mine heap memory keep on increasing without letting it for garbage collection i used set method as well giving same issue.
mine backend eventually get crash after sometime showing out of memory
ioredis have memory leak issue where the data gets add on time by time and the backend gets crashed
//setup :
const Redis = require("ioredis");
require("dotenv").config();
const redisConfig = {
host: process.env.REDIS_HOST,
port: process.env.REDIS_PORT,
retryStrategy: (times) => {
const delay = Math.min(times * 50, 2000);
return delay;
},
};
// Create separate clients for pub/sub and regular operations
const redis = new Redis(redisConfig);
const publisher = new Redis(redisConfig);
const subscriber = new Redis(redisConfig);
// Event listeners for main Redis client
redis.on("connect", () => console.log("✅ Redis client connected"));
redis.on("error", (err) => console.error("❌ Redis client error:", err));
// Event listeners for publisher
publisher.on("connect", () => console.log("✅ Redis publisher connected"));
publisher.on("error", (err) => console.error("❌ Redis publisher error:", err));
// Event listeners for subscriber
subscriber.on("connect", () => console.log("✅ Redis subscriber connected"));
subscriber.on("error", (err) => console.error("❌ Redis subscriber error:", err));
module.exports = {
redis,
publisher,
subscriber
};
//function :
const { redis, publisher } = require("../redis/redisSetup");
const fs = require("fs");
const path = require("path");
const storeTickData = async (token, data) => {
try {
const key =
tickDataNew:${token}
;} catch (error) {
console.error(
❌ Error storing tick data: ${error.message}
);return "error";
}
};
The text was updated successfully, but these errors were encountered: