Please describe the problem you are having in as much detail as possible:
When using our production token (500k+ users) it continuously gains memory until it crashes with out of memory (4gb+) after 4-5 hours.
I've tested reinstalling node/discord.js/npm
Include a reproducible code sample here, if possible:
const Discord = require('discord.js');
const client = new Discord.Client({
shardCount: 'auto' ,
messageCacheMaxSize:1,
messageCacheLifetime:30,
messageSweepInterval:60,
disabledEvents: [
'GUILD_CREATE'
,'GUILD_DELETE'
,'GUILD_UPDATE'
,'GUILD_MEMBER_ADD'
,'GUILD_MEMBER_REMOVE'
,'GUILD_MEMBER_UPDATE'
,'GUILD_MEMBERS_CHUNK'
,'GUILD_ROLE_CREATE'
,'GUILD_ROLE_DELETE'
,'GUILD_ROLE_UPDATE'
,'GUILD_BAN_ADD'
,'GUILD_BAN_REMOVE'
,'GUILD_EMOJIS_UPDATE'
,'GUILD_INTEGRATIONS_UPDATE'
,'CHANNEL_CREATE'
,'CHANNEL_DELETE'
,'CHANNEL_UPDATE'
,'CHANNEL_PINS_UPDATE'
,'MESSAGE_CREATE'
,'MESSAGE_DELETE'
,'MESSAGE_UPDATE'
,'MESSAGE_DELETE_BULK'
,'MESSAGE_REACTION_ADD'
,'MESSAGE_REACTION_REMOVE'
,'MESSAGE_REACTION_REMOVE_ALL'
,'USER_UPDATE'
,'PRESENCE_UPDATE'
,'TYPING_START'
,'VOICE_STATE_UPDATE'
,'VOICE_SERVER_UPDATE'
,'WEBHOOKS_UPDATE'
]
})
client.login(TOKEN);
Further details:
If you have 'GUILD_CREATE' disabled the bot will never ready, and will timeout. So, do you have any actual reproduction code?
Can you use a tool like ndb to create heap snapshots of your actual project and make comparison views to see exactly what is being added over time?
After I enabled GUILD_CREATE the memory issue resolved itself, That feels like an oversite not to give a warning about GUILD_CREATE affecting the event READY. do you have a list of what each event affects and/what they do?
either way, it's resolved.
If you disable events, we can't give you any guarantees about will/won't work later on, but GUILD_CREATE will probably break quite a lot of things. The option was really designed for smaller events, e.g. PRESENCE_UPDATEs that are mostly inconsequential to the operation of the library.
Either way, thanks for confirming the issue is fixed!