Memory leak when sharding
I'm experiencing a memory leak when using sharding in my bot, obviously memory leaks are hard to debug so I just would like some advice on how to diagnose the issue.
The bot slowly rises in memory usage up to 2-3 gbs until it runs out of memory. I tried running heap snapshots, but that didn't provide meaningful results.
I've tried using
discord-hybrid-sharding
and without it, with the same results.
I've tried switching tokens to a bot with around 5 servers, and memory usage started low due to having less things to cache, but always grew in memory until crashing.
Yet, removing the sharding refactor never had memory climb indefinitely.
Has anyone experienced similar issues, I'd appreciate some advice on what to do/where to look.6 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!Cluster.ts
Lmk what other files i should send
dev bot without sharding = ~150 mb
dev bot with sharding = 490 mb at start and climbs rapidly without stabilizing
prod bot without sharding = (cant because its above 2500)
prod bot with sharding = 2000 mb at start and climbs without stabilizingI also have this problem. After starting the bot with sharding about 85mb and after about 2 days 120mb
But after just 3 days 180mb
is there a way to clear them?
Im honestly not sure what I did, but it may have solved itself (?)
been a busy week so I haven't actually tested much. but memory usage seems normal now
I have pretty much the same issue