Skip to content
This repository has been archived by the owner on Jan 8, 2022. It is now read-only.

(@discordjs/rest) Hashes can cause memory leak #40

Open
Deivu opened this issue May 11, 2021 · 0 comments
Open

(@discordjs/rest) Hashes can cause memory leak #40

Deivu opened this issue May 11, 2021 · 0 comments
Labels
bug Something isn't working priority:high rest

Comments

@Deivu
Copy link

Deivu commented May 11, 2021

Please describe the problem you are having in as much detail as possible:

As I noticed in:
https://github.com/discordjs/discord.js-next/blob/6ebe80f1d3f72c6d66e515620c590d4cd6398a15/packages/rest/src/lib/RequestManager.ts#L119
and
https://github.com/discordjs/discord.js-next/blob/6ebe80f1d3f72c6d66e515620c590d4cd6398a15/packages/rest/src/lib/handlers/SequentialHandler.ts#L167

Hashes will the be empty at first and will just pile up as the bot runs, and replace the existing hash when the hash is updated, but this doesn't account deletes, ex: guild delete, channel delete, etc. means those hashes from those deleted guild, channels, etc will remain in memory. Since there are no sweeper, or a lru cache that can remove the unused hashes after x amount of time, this existing hashes that is from a deleted guild or channel will pile up causing a memory leak, which can eventually crash a bot

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working priority:high rest
Projects
None yet
Development

No branches or pull requests

2 participants