-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hubot responds 4 times to one message. But only some times? #1715
Comments
Nothing in the code immediately stands out to me as the culprit. I have a few probing questions:
|
Docker container in ECS
1
Yes. Read-only access. And importantly, it's to the ECS Clusters. Not separate accounts/environments/etc.
11.1 |
Does it only respond 4 times when the value is "Production"? |
Or when I leave it to "default". So when |
what chat adapter are you using? |
https://github.com/hubot-friends/hubot-slack (Updated all that in the initial question, too) |
Ok. I've seen this behavior before during development. The issue was that the code failed to acknowledge the message. In that situation. the Slack system will "retry sending the message". Here's where the code is supposed to acknowledge the message. I also see an issue in the Slack Adapter. It's not |
Can you start Hubot with HUBOT_LOG_LEVEL=debug to see what line of code the execution is getting to? |
I've also added the |
Updated to the new adapter and I still get the duplicate messages. :( |
Another thought is to |
|
Is it odd that the |
Can you run a Hubot instance locally on your machine and replace the behavior? |
It sounds like you might have a plausible cause, so add several grains of salt to anything in this comment :) When I've observed Hubot get into a repeats-replies state, I had a suspicion it related to functionality such as remind-her or polling plugins (eg watch statuspage, report when status changes). It seemed like the use of If the current best theory doesn't pan out, maybe consider which plugins could be disabled to isolate the behaviour? |
There is a timeout in the slack response! Because this query to AWS is relatively slow, that doesn't entirely surprise me:
|
It's definitely me racing a timeout! I changed the code to batch AWS requests more efficiently and I'm no longer getting duplicate messages! Relevant code:
|
Well done tracking down this bug. I don't see the code that "batches the AWS requests". Would you mind pointing it out for me? I'd love to see how you solved it. I'm also curious if there's a move I can make to the Slack Adapter to either not let this situation happen or make it very visible that it's happening. |
Sure. The batch happens here:
Let's expand that a bit: Instead of doing
I now loop through the list of I think perhaps surfacing the request timeout (somehow) would be amazing. Just so we know it's there. |
I see. The new code changes let input = {
cluster,
services: [service],
include: []
} to let input = {
cluster,
services: services,
include: []
} where |
Closing this as it seems to be more an issue with timeouts within adapters. Thanks for the help! |
I've been running in to this issue again. In some cases, I can improve the performance of the commands Hubot runs and avoid the race. In others, it's just an expensive query (or an expensive series of queries). I wasn't fully clear if this was adapter-specific or if this was a problem within Hubot itself. |
Which slack adapter are you using? |
I'm happy to get on Discord to troubleshoot. I'm in Central time. Other reasons that I've seen multiple responses to a single message is that multiple regexes (in the respond setup) match the message and so multiple handlers execute. |
I appreciate the discord offer, but I don't actually have an account currently. I'll look in to that. I could see multiple responses from different regexes happening, sure, but wouldn't the responses then be different? Not the same response 4 times? |
MS Teams and Zoom would work too. Yes, if the handlers do and respond with different results, they would be different. |
We've written a custom hubot script to interact with AWS and report back to users. One of our responses will respond 4 times (with the exact same data, over ~20 minutes) in certain circumstances, and I can't understand what's happening.
So it starts normal enough:
So then I can say something like
@hubot ecs list stale tasks in Production
and Hubot will come back with data about what we consider stale tasks.What's interesting is that depending on the cluster I select, Hubot will either reply once (expected) or 4 times (far less expected):
@hubot ecs list stale tasks in Production
responds 4 times with the exact same data, over about 20 minutes.@hubot ecs list stale tasks in Development
responds once.@hubot ecs list stale tasks in Staging
responds once.We're using https://github.com/hubot-friends/hubot-slack as our adapter.
We only run a single instance of Hubot (because otherwise it can go split-brain) in a docker container in ECS. We are on the most recent release of Hubot (11.1.1).
My instinct is that it's something in the data, or how I'm handling pagination with AWS requests. But I'm honestly not sure. So any hints that y'all could provide would be amazing.
I'll provide the entire script below, just please don't judge my JS too harshly, I've never been good at it.
Actual script
The text was updated successfully, but these errors were encountered: