slack-ruby-bot: Duplicate responses to commands after bot is left idling w/ celluloid
Hi there,
We are using this gem in a simple project that uses a database. We’ve noticed that when we let the app idle for some time (unsure exactly for how long, maybe about an hour) then the bot processes text commands multiple times. The gems slack-ruby-bot and slack-ruby-client are on the latest version.
I have created a minimal setup with which I am able to reproduce this issue: https://github.com/jillguyonnet/slack_ruby_bot_minimal. This is a very simple app that manages a list of items. Note that it was based on https://github.com/slack-ruby/slack-ruby-bot/blob/master/TUTORIAL.md and uses the MVC approach. The available commands are:
hishow: print a list of itemsadd: add an item to the listclear: clear the list
Similar to our real project, the issue of multiple command processing happens when I let the app run for a while. Here is a screenshot where the bot responds twice to hi:

The steps to reproduce are:
- Run the app, check that it works by running some commands.
- Let it running for a while (at least an hour but possibly several hours).
- Run some commands again. More often than not (but not always), the issue will present itself.
We are currently investigating potential sources for this issue. Without confirmation, we think these might include:
websocket_pingsetting on the realtime client (https://github.com/slack-ruby/slack-ruby-client/blob/master/README.md#configuring-slackrealtimeclient) currently not set to zero. Could this issue be caused by the client attempting to reestablish its connection to the message server?- The
CONCURRENCYenvironment variable is not set.
Would you, based on this information, be able to suggest the cause of this issue and the best way to fix it?
Thanks
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 2
- Comments: 15 (1 by maintainers)
Commits related to this issue
- Upgrades to Rails 6 and ruby 2.5.0. See body for details as to why That earlier fix didn't work lol. But I did find an issue on the slack-ruby-bot github repo that seems to describe the exact issue i... — committed to oliverswitzer/balloon-bot by deleted user 5 years ago
- Replace Celluloid w/ Faye-Websocket We're having an issue where the bot once idle for a while will process commands multiple times. My research lead me to the issue in Slack-ruby-bot which I included... — committed to korukids/slack-bot-dev-support by rpass 4 years ago
- Merge pull request #13 from asherkory/ak-wfh-fixes Use async-websocket instead of celluloid: See slack-ruby/slack-ruby-bot#236 — committed to asherkory/lunchbot by asherkory 4 years ago
I would appreciate if someone could get to the bottom of this with celluloid. Good project to dive deep!
We’re happy to report that after a week of testing using async-websocket and
CONCURRENCY=async-websocketseems to have fixed the issue for us as well. 🎉