-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Description
Hey, since updating to 12.4.0 (and then tested on master as well) from 12.3.1 on a sharded bot (2 shards, ~1000 servers per shard) I noticed individual shards are not always respawning when it comes to certain errors (e.g. SIGABRT or SIGSEGV caused by out of memory errors, but this list might be partial).
Reverting back to 12.3.1 restores the automatic respawn.
You can test this by spawning a simple bot with 2 shards and then forcing a memory leak with:
const test = [];
if (client.shard.ids[0] === 1) for (let i = 0; i < 1e10; i += 1) test.push(Math.random());Behavior on 12.3.1 (my custom logs, ymmv):
[ShardingManager] [Shard 1] Child process [ 11126 ] closed with signal code [ SIGABRT ] and exit code [ null ]. Killed? [ false ].
[ShardingManager] [Shard 1] Spawned child process with PID [ 11143 ].
Behavior on 12.4.0 and master:
[ShardingManager] [Shard 1] Child process [ 11329 ] closed with signal code [ SIGABRT ] and exit code [ null ]. Killed? [ false ].
For this last case, the shard respawn is never triggered (last downtime lasted ~7 hours before I could restart the process).
Manually triggering shard.respawn() on the "death" event cases the shard to spam the "death" event N times, and then respawning N processes.
manager.respawn is correctly set to true in both cases.
Further details:
-
discord.js version: 12.4.0 / master
-
Node.js version: 12.19.0
-
Operating system: Amazon Linux 2 (CentOS), Ubuntu 18.04
-
Priority this issue should have – please be realistic and elaborate if possible: High (only for sharded bots), could not find a workaround other than restarting the whole process.
-
I have also tested the issue on latest master, commit hash:
250c3ae3c1f025c092383e4661bbb386e89a3c23