Bot stops responding after some time...
I'm running botkit within a container (on AWS, if it makes any difference) and I've noticed that -- without fail -- the bot will simply stop responding after "a while" ... which could be a day, two days, sometimes even 3-4 days. The process is not dead, the container is certainly not dead, but none of the commands defined will return anything anymore.
Absolutely nothing further is logged on the console once it stops responding, and no error messages prior to that.
Driving me insane. Anyone else had this? Node version 6.4.0.
Just happened again after 4 days of uptime ... just stopped responding and nothing in the logs :(
Looks like there are others having similar issues:
https://github.com/howdyai/botkit/issues/445 https://github.com/howdyai/botkit/issues/276
I am currently trying with the retry option to controller.spawn, and I've upgraded to v0.4. Will report back in a few days with the outcome.
I would suggest you ask your question on dev4slack. Tips for bot uptime and keeping your bot running come up often there, and there are a number of good tips in the history.
@gservat #261 might be helpful.
@gservat did 0.4 solved this issue? I am having the same problem, but i can see it is happening only after a conversation is about to start (bot.StartConversation()).
Struggled with this one for a while, found this bug and created this PR
https://github.com/howdyai/botkit/pull/532
Very simple change from bot to botkit. Reconnect has been working flawlessly since. Also using the following code to notify me in slack of reconnects, drops, and other slack RTM messages.
controller.on('rtm_close',function(bot) {
console.log('\n\n*** '+moment().tz('America/Los_Angeles').format()+' ** The RTM api just closed');
try {
controller.findTeamById('<SLACK_TEAM_ID_HERE>', function(err, team) {
var alertBot = controller.spawn(team);
alertBot.api.chat.postMessage(
{
channel : '<SLACK_CHANNEL_ID_HERE>',
text: 'GUYS!!! I just got an RTM Close event trigger for this team --> '+bot.team_info.id+' '+bot.team_info.name+' .',
attachments: [],
}, function (err, response) {
});
});
} catch (err) {
console.log('\n\n*** '+moment().tz('America/Los_Angeles').format()+' Tried to send alert for an rtm_close event but failed with this error: '+err);
}
});
controller.on('rtm_reconnect_failed',function(bot) {
console.log('\n\n*** '+moment().tz('America/Los_Angeles').format()+' ** Unable to automatically reconnect to rtm after a closed conection.');
try {
controller.findTeamById('<SLACK_TEAM_ID_HERE>', function(err, team) {
var alertBot = controller.spawn(team);
alertBot.api.chat.postMessage(
{
channel : '<SLACK_CHANNEL_ID_HERE>',
text: 'GUYS!!! I just got an RTM Reconnect Failed trigger for this team --> '+bot.team_info.id+' name: '+bot.team_info.name+'. The team either uninstalled the app or there was an issue which requires a resart of the bot.',
attachments: [],
}, function (err, response) {
});
});
} catch (err) {
console.log('\n\n*** '+moment().tz('America/Los_Angeles').format()+' Tried to send alert for an rtm_reconnect_failed event but failed with this error: '+err);
}
});
Apologies; "a few days" turned into "a few months". Yes, upgrading to 0.4 fixed it.
Closing as resolved then! Thanks for the confirmation!