Started sharding: a lot of `unknown interactions`
I'v seen a consitant increase in unknown interaction since I started shardig (was barely getting any when it wasnt sharded).
My bot works mainly through Dms, which by default are all handled by shard 0 (so there is no need to communicate between shards). I do still get unknown interaction from dms buttons tho (like 1 out of 20).
I dunno what I could be possibly doing wrong since the code barely changed from before sharding to now.
And the first thing I try to do asap is to defer such interaction anyway
ShardingManager:
18 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!on the index.js file:
So it's not that im doing much before trying to
defer
asap.
Im using OVH, If it's the provider the issue, before sharding I was still with OVH in europe w/o much interaction issues, now I moved it to Canada. east coast.. which should be even closer to Discord api
the bot is in 2k servers, so there isnt much traffic
(I have 4 cores and 8GB Ram)
omitted to avoid verbose boilerplate
totalshard is 5
shardlist is the shards that should run on this machine, while in the future other shards will operate on separate machines
hence why the totalshard is in the file that I will just copy over to external vps
(im not yet doing that tho)
isnt totalshards accross all machines, while shardlist is what is assigned to this specific machine?
indeed that's for the future when I'll add external ones
So I dont have to worry for a long time
well is mainlny coz of the 2.5k limit per shard, since iv 4 cores and 8gb ram I'd imagine 5 shards is not that demanding?
As in, shard 0 handles dms, data should directly go to such shard w/o bouncing around, unless you saying this is what actually happen?it's not that busy

well im consistently getting them every 20ish interactions, but never on my end when testing.
I tried lately
but now im getting
which is actually an error that reboots the shard - even tho everything is in a try catch
Because why are you running so many instances of your ShardingManager?Sure I could change it, but shouldnt 4 cores and 8bg be more than enough to handle 5 shards? Even more so now that 2k servers are spread among 5 shards
No, it isn’t. But you‘re limiting your shard 0 to less resources when you force the ShardingManager to spawn more shardsSure, I mean when/if I'll have 200.000 servers, this main server will probably be just for shard 0 and worker threads I'd imagine, but im far from this scenario currently Are you implying that, with this current server specs, having 5 shards is the cause of the
unknown interaction
?
So it's not that common to get unknown interactions when switching to sharding?
In that case it could also me being unlucky on having been assigned by ovh a server that is actually busy lol, since it's not dedicated.
Unfortunately I never get errors when it's me checking (of course)
So hard to tell
looks good here

could these sweepers be the cause?
ya was worried of some under the hood things that may be causing these unknown interactions..
btw
interaction.createdTimestamp
is the same time which discord expects a reply within the 3 secs span?
im also not seeing interactions ids duplicates
now that i reduced it to 2 shards im may be seeing less frequent errors
for a 4 vcores 8bg ram what is the suggested amount of shards such machine can host?
well im really lost
my bot is not that busy atm
dunno if setting the process to higher priority would fix this weird unknown interaction
well this is a new error I never seen before
should I add a delay when spawning shards? Does discord prefer it?tag suggestion for @Mulo:
Errors such as
ECONNRESET
, ConnectTimeoutError
, SocketError: other side closed
indicate a network issue
* Free or shared hosting providers often come with significant limitations
* Another indication of these issues are 'Unknown Interaction' errors.I would understand that, but how can it be that it gives
unknown interaction
when i log the now -.createdTime
and is always way less then 3000.
If it was a network issue wouldnt that be > 3000?
well you receive interactions via ws, but you reply to them via rest
so technically they can be entirely unrelated, and there can be issues with one but not the other
im usinv ovh canada
would changing dns to cloudflare be of any help?
I'd say try checking this first
that is indeed the case
yeah your defer is taking way too long to reach
tho im getting it once every 30 other interactions that do work well
so im not sure what could it be
processing applications through dms, but im getting this apparent delay not only from dms butons but from any guild as well
?
will try to see tools that checks I/O but for sure htop shows that all is quiet
very quiet
only thing I can say is that when I had this normal bot on a 1vcore 2gb ram vps in germany I was barely getting any unknown interactions, now in canada (which should be closer to discord api) with 4c and 8gb I ran into these probelms 😄
running some debugging tools and all seems to be normal
Tho im wondering, if it was some sync ops clogging up the system, shouldnt I get delays when first receiving the interaction as well? - and not only when trying to defer them?
right but if the cause of this were whatever internal long running sync op, I would be seeing issues on both send/ receive. Since this is not the case, im out of options beside external server provider issues
Should I try this to manually debug the issue



im noticing im getting unknown interaction on another bot im running as well, which is not sharded
im using
[email protected]
btw
the other bot file? no, same machine
i have 1Gbps, as the graph supposedly say im way below it
just 2 (one sharded) the other normal (it's in 300 servers)
and 2 websites
is this a concen?
also:
im barely getting a log, if not only on reboot
also rarely getting this, and not when getting
unknwon interaction
can promises be realistically the problem?
as in any async process
or
to have these issues, it should rather be sync ops issue
that's assuring 😄
i was with ovh in eu w/o much problems, now stil ovh in canada
btw sidenote, i tried pinging discord with traceroute
and it seems the connection is not direct as one might think
as in there actually wouldnt be much difference between having a bot in north america and europe
well it seems like doing the oldest trick in the book - aka rebooting - might have alleviate the issue. Tho I guess is common to have unknown interaction
here and there for everybody (hopefully).
But when installing couple of debugging tools they erased the node modules folder and messed up something that next.js is not able to build websites, how nice.