RocketChat / hubot-rocketchat-boilerplate

An example Hubot demonstrating usage of the Rocket.Chat adaptor.
MIT License
36 stars 32 forks source link

Bot Disconnects after approximately 50 messages #10

Open sqasquared opened 4 years ago

sqasquared commented 4 years ago

I've installed a fresh install of hubot-rocketchat-boilerplate, setup an unchanged bot, configured and ran it using the bin/hubot shell command. I see that the bot connects because the bot user indicator in rocket.chat is green. Everything seems fine - the bot responds to requests - till hubot observes approximate 50 messages. "Observes" meaning that the following line is displayed in the hubot script console:

[Wed` Nov 27 2019 17:58:08 GMT-0800 (Pacific Standard Time)] INFO [received] Message in room vnuc9Sims6QTacAGH

Whether those messages were addressed to the bot or not. At which time the hubot script appears to disconnect from rocket.chat in that the user indicator light for the rocket.chat bot user goes black. Also, it no longer responds to request, nor does it "observe" messages in script console, though messages continue to be created in rocket.chat.

50 is approximate because sometimes 2 or 3 more, sometimes 2 or 3 less.

I've tried this using multiple configurations and OSes - linux, mac - and have tried it with a docker instances, and in all cases around 50 observed messages and the bot disconnects.

Time does not seem to be a factor because if I increase or decrease the speed of messages entered into chat, it will disconnect sooner or later but always around 50 messages.

I know that the hubot is still running because I have configured a heart beat and that continues to beat even after the bot disconnects from rocket.chat.

Is there some kind of limit, threshold or configuration for the number of messages the bot will "observe"?

To be clear, this is a completely unchanged bot, executed right from the boiller plate git clone directory.

Here is the env configuration:

export ROCKETCHAT_ROOM='general'  
export LISTEN_ON_ALL_PUBLIC=true 
export ROCKETCHAT_USER=bot   
export RESPOND_TO_DM=true  
export ROCKETCHAT_PASSWORD=Password  
export HUBOT_NAME=bot 

bin/hubot
sqasquared commented 4 years ago

The only unique thing is that the messages that the bot observes are messages entered in rocket.chat by a separate service that uses rocket.chat api. So though a standard message entered by a user would generate this in the bot's console:

[Wed Nov 27 2019 18:27:08 GMT-0800 (Pacific Standard Time)] INFO [received] Message in room CLsdhhRwh2S6gxeqB
[Wed Nov 27 2019 18:27:08 GMT-0800 (Pacific Standard Time)] INFO [received] Message 3rHW7zxPfQpATrxKG from joe_user
[Wed Nov 27 2019 18:27:08 GMT-0800 (Pacific Standard Time)] INFO Filters passed, will receive message

while when the message is created by the rocket.chat api. the bot's console only displays one log entry:

[Wed` Nov 27 2019 17:58:08 GMT-0800 (Pacific Standard Time)] INFO [received] Message in room vnuc9Sims6QTacAGH
sqasquared commented 4 years ago

Further discovery: Found that the disconnect only happens when the rocket.chat api calls use the same bot user to connect to chat and push messages. That is rocket.chat api and hubot using the same bot user.

If we use a different bot user from the api to push messages, the hubot bot does not disconnect.