Bot keeps restarting every 2-4 hours, reinstalls packages

#1

For whatever reason, my Discord.js bot keeps restarting every couple hours, and every time it does, it reinstalls all of its dependencies which causes it to remain down for anywhere between 2 to 10 minutes.
I have an UptimeRobot pinging (and notifying me of the down times) and this is clearly below the 12 hour limit.
Project name: ressa
I’ve seen no errors, and whenever I watch it, it doesn’t seem to restart.

0 Likes

#2

Hey @Hikitsune-Red, welcome to the Glitch forum!

If you’ve been mostly seeing this recently it’s possible that it’s related to having to move servers - we’ve had a rash of hosts banned by Discord recently and have been moving projects around a little more than usual due to that - each of those moves would cause a restart. Generally speaking, though, if you’re seeing your project restart more than every 12 hours or so that indicates something else is going on. If your bot crashes the Node process (which does happen) that would trigger a restart like this, as would your project going over CPU or Memory limits.

One route to track down what might be causing specious restarts would be to add some logging to your bot’s command to help track what’s being called when, and also to trap the SIGTERM event that Glitch sends your project when it shuts down using something like what’s discussed in Ways to comunicate with glitch and logging that. Between those two things, analyzing the logs might provide some insight into what’s happening in your project when it shuts down.

Hope this helps!

1 Like