Project restarts every so often

Lately my project ‘cmb’ has been restarting every 20 minutes or around that time.
https://gyazo.com/6df22377249dcc99ea3ef5e207ef374e
^ That is an image of each time my project has started.

I have no idea why this is happening, the logs show no errors at all, it just… restarts.
Any help is appreciated <3

1 Like

Same thing happening to my project, too.

From a Discord Bot Developer and Glitch User,
TehPig_YT

1 Like

I have decided that I am moving all my bots off glitch, and will only use glitch for my website(s)!

1 Like

I took a look at ~cmb a couple of times yesterday, and I do see the unexpected restarts. I was going to suggest you instrument your modules with log messages and also log the shutdown call (a la Ways to comunicate with glitch) to see if there are some patterns about what your bot is doing before it gets shut down. I don’t see anything useful in our logs but haven’t given up just yet.

2 Likes

Just going to add, the reason I have decided to move away from glitch for nodejs projects is completely unrelated to any problems I was having, it is due to the fact that my bot is growing to a point where I feel its better hosting it on my vps!

2 Likes

That’s good to hear, @Callum-OKane!

2 Likes

The only thing that’s bad for me that the projects sleep too soon (in 5-10 minutes) that music functions cannot be used easily since the bot stops playing music when restarting for no reason. I’m online all day and see it restarting again and again.

From a Discord Bot Developer and Glitch User,
TehPig_YT


I cannot understand what are you telling exactly.

From a Discord Bot Developer and Glitch User,
TehPig_YT

I was saying that you can trap the exit signal Glitch sends to your project when it’s shutting down (before it starts up again) so you can tell when Glitch told the project to shut down. Combine that with some console.log statements in the various methods inside the bot and you can get an idea of what the bot has been doing. It’s possible that something in one of this bot’s commands is triggering a restart for some unknown reason - knowing what the last few commands that were executed before the restart are might help figure out what’s going on.

1 Like

Um… I don’t think that a bot’s command is causing the restart. I’ve left the bot playing music with me in it and without a reson, it restarts and no one is using the bot’s commands. I can tell that for sure. I’m sorry if I haven’t still understood. And it’s not that the music system is causing the problem because it’s functioning pretty good until the bot stops working (also stops the playing song). And I really want to stay on Glitch because Glitch has offered me a lot and I want still to support it and help me with it’s own way.

From a Discord Bot Developer and Glitch User,
TehPig_YT

I haven’t looked at your project at this point; I don’t even know that project name. And I’m not talking only about bot commands - just knowing what code the bot last executed before it restarted, whether that’s a command or something else entirely, might help figure out what’s causing the restart.

For instance, exceeding CPU or memory limits could cause a restart, and it’s possible some of those paths aren’t logging useful data. Knowing what sorts of activities preceded a restart might be useful to know and is about the only thing I can think of right now to help figure out why a specific project is restarting.

1 Like

Here’s the current container’s stats. image
I can send an invite if you can check it. Because I’m really desperate right now about this topic.
And it’s really important to me to be solved (if it can) with the best possible way.
Project Name: t-moderator-bot

From a Discord Bot Developer and Glitch User,
TehPig_YT

Music bots usually take up alot of memory on glitch, where it gets to the point that your project forcefully restarts itself after 15 seconds, this could be what is happening!

1 Like

Yes but when I have it in a project with only music commands, it works fine. I’ve checked it since I was using another bot for the music system before this one.

From a Discord Bot Developer and Glitch User,
TehPig_YT

I think that I had made the biggest mistake in my project. Because I had added the following lines into the website, the bot has got that problem

const http = require('http');      
const express = require('express');
const app = express();
app.get("/", (request, response) => {
  console.log(Date.now() + " ping recieved. I think.");
  response.sendStatus(200);
});
app.listen(process.env.PORT);
setInterval(() => {
  http.get(`http://${process.env.PROJECT_DOMAIN}.glitch.me/`);
}, 280000);

And I think that the problem now has been fixed successfully! Thank you for your support @Callum-OKane and our beloved @cori that has helped me at least 5 times to solve my problems! Thank you very much! Final Result: Problem was mine and not Glitch’s.

From a Discord Bot Developer and Glitch User,
TehPig_YT

1 Like