Discord.js: Possible Memory leak

Created on 17 May 2019  Â·  3Comments  Â·  Source: discordjs/discord.js

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:

  • discord.js version: 12.0.0-dev
  • Node.js version:10.15.3
  • Operating system:Windows 10 x64
  • Priority this issue should have – please be realistic and elaborate if possible:Low - Others have been unable to reproduce this issue.
  • [x] I have also tested the issue on latest master, commit hash:#55447fd4da08ae9e633dca3c4faff5a9b77d440e
invalid

All 3 comments

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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

PassTheMayo picture PassTheMayo  Â·  3Comments

DatMayo picture DatMayo  Â·  3Comments

Lombra picture Lombra  Â·  3Comments

tom-barnes picture tom-barnes  Â·  3Comments

ghost picture ghost  Â·  3Comments