High usage leak after updating to v13@latest (13.14.0)

Does DJs have any known usage leak? Because after updating djs v13 to latest after 5h the usage go over 26gb ram and 60% CPU usage the code didnt changed at all only the djs version got updated? And if not any ideas what could create such high usage in seconds?
10 Replies
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
sean
sean15mo ago
Here some graphs as you can see it was fine before (At 9:30 the code with djsv13.14.0 got started)
sean
sean15mo ago
I dont have any other graphs and I'm not 100% sure if it comes from djs but I can say that it need to have something todo with it because nothing other got changed at the time and when I say nothing I REALLY mean nothing. Some hours before (6h) the client crash I got this inside of my logs
HeadersTimeoutError: Headers Timeout Error
at Timeout.onParserTimeout [as _onTimeout] (/root/bettyBOT/node_modules/undici/lib/client.js:902:28)
at listOnTimeout (node:internal/timers:571:11)
at process.processTimers (node:internal/timers:512:7) {
code: 'UND_ERR_HEADERS_TIMEOUT'
}
HeadersTimeoutError: Headers Timeout Error
at Timeout.onParserTimeout [as _onTimeout] (/root/bettyBOT/node_modules/undici/lib/client.js:902:28)
at listOnTimeout (node:internal/timers:571:11)
at process.processTimers (node:internal/timers:512:7) {
code: 'UND_ERR_HEADERS_TIMEOUT'
}
But I dont think it have something todo with it because its away to much hours before the usage leak
sean
sean15mo ago
NodeJS Version and DJS Version:
sean
sean15mo ago
Bot stats: 8.4k guilds, average ram usage before: 400-500mb per 4.2k Guilds ( Bot is clustered) and 12 shards
Syjalo
Syjalo15mo ago
Do you have any custom cache, sweepers in your client options? It's better to show the full client options
sean
sean15mo ago
yes i post them when im back on my pc (~15m)
const client = new Discord.Client({
intents: ['GUILDS', 'GUILD_MESSAGES', 'GUILD_VOICE_STATES'],
shards: Cluster.data.SHARD_LIST,
shardCount: Cluster.data.TOTAL_SHARDS,
retryLimit: 20,
disabledEvents: config.disabledEvents ?? [],
makeCache: Discord.Options.cacheWithLimits({
...cacheOptions,
}),
});
const client = new Discord.Client({
intents: ['GUILDS', 'GUILD_MESSAGES', 'GUILD_VOICE_STATES'],
shards: Cluster.data.SHARD_LIST,
shardCount: Cluster.data.TOTAL_SHARDS,
retryLimit: 20,
disabledEvents: config.disabledEvents ?? [],
makeCache: Discord.Options.cacheWithLimits({
...cacheOptions,
}),
});
CacheOptions:
const userFilter = (user) => user?.id !== client?.user?.id;
// Custom Cache Options
const cacheOptions = {
BaseGuildEmojiManager: 0,
GuildBanManager: 0,
GuildInviteManager: 0,
GuildStickerManager: 0,
PresenceManager: 0,
ReactionManager: 0,
ReactionUserManager: 0,
ThreadManager: 0,
ThreadMemberManager: 0,
CategoryChannelChildManager: 0,
MessageManager: 0,
UserManager: {
maxSize: 1000000,
sweepFilter: () => userFilter,
sweepInterval: 5 * 60 * 1000,
},
GuildMemberManager: {
maxSize: 1000000,
sweepFilter: () => userFilter,
sweepInterval: 5 * 60 * 1000,
}
};
const userFilter = (user) => user?.id !== client?.user?.id;
// Custom Cache Options
const cacheOptions = {
BaseGuildEmojiManager: 0,
GuildBanManager: 0,
GuildInviteManager: 0,
GuildStickerManager: 0,
PresenceManager: 0,
ReactionManager: 0,
ReactionUserManager: 0,
ThreadManager: 0,
ThreadMemberManager: 0,
CategoryChannelChildManager: 0,
MessageManager: 0,
UserManager: {
maxSize: 1000000,
sweepFilter: () => userFilter,
sweepInterval: 5 * 60 * 1000,
},
GuildMemberManager: {
maxSize: 1000000,
sweepFilter: () => userFilter,
sweepInterval: 5 * 60 * 1000,
}
};
So I should remove BaseGuildEmojiManager and CategoryChannelChildManager? what would u suggest me else? I tried to not cache everything that I dont use lol and I have a memory sweaper on user and guild member bcs I use them but the average lifetime is like 15m then I dont access the user anymore But still why should makeCache create a CPU Leak in 1 minute and a Memory leak ? Like it didnt did that the whole time and out of nothing it does it it didnt got released the cluster crashed because of reaching the nodejs memory limit xd it never happend before its now the first time since the restart it also didnt happend again yet I could check the debug logs from djs give me one minute yeah log file is 3gb big I need more than 1 minute OMEGALUL pm2 logs Okay I could share the error logs with you the normal logs dont have anything useful This is between 17:30 and 23:00 https://babe-please-love.me/opula.typescript 1 time per hour to update some messages and if someone use /clusters but this dont happen often yeah I want to update the bot to v14 then I will do all these changes xd It happend again i need to check what i can see in the logs And it happend again
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
sean
sean15mo ago
Actually the issue isnt because of caching or anything like this I now found out the issue it would be still interesting why it happend after installing djs v13.14.10 but it have actually not really something todo with djs Its creating a infinity loop of no match lavalink requests i need to investigate this more but as i said this isnt really related to djs i guess