-
Notifications
You must be signed in to change notification settings - Fork 230
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
Pubsub emits more messages then allowed by maxMessages and allowExcessMessages after reaching maxExtension period #1213
Comments
@QuestionAndAnswer Thanks for the super detailed report. I'll have to go over this in more detail, but I'll mark it as a bug for now. I like your editor's comment on the method. 😂 |
@feywind so, how is it going? Did you have a chance to look into this issue? |
@feywind we are running into the exact same issue in production. Node 14 Running it in a similar env, docker container inside k8s. Any progress here? |
Quick (sadly content-less) update - no changes here yet, but I've been on a bit of a feature development rotation and hope to get back to these issues. |
I stared at this for a while today, and I'm not as familiar with this bit of the library, but I don't know why we'd want to dispense messages from the pending queue just because another message was removed. It feels like there was a paradigm shift here that wasn't taken into account, but I'm going to ask some others. |
Linked to the meta-issue about transport problems: b/242894947 |
Is there any way to bypass the problem? Our cluster is running out of memory and options regarding flowController don't seem to work. Maybe is there a way to stop subscribers to listen an enormous amount of messages pulled? |
We have the same problem with @google-cloud/pubsub version: 3.4.1 . Any updates or workaround for this issue? |
…-max-messages-limit fix: googleapis#1213 Pubsub emits more messages then allowed by maxMessages and allowExcessMessages after reaching maxExtension period
…-max-messages-limit fix: googleapis#1213 Pubsub emits more messages then allowed by maxMessages and allowExcessMessages after reaching maxExtension period
For those who were interested in a workaround:
(It could work without The point is that you need to set it on every connection to the broker. It looks like the setting is ignored when you use it in the I've tested it on |
Environment details
@google-cloud/pubsub
version: 2.6.0Looking into the code, and issue details this also should be relevant for 2.9.0.
Steps to reproduce
You would need 1 topic and 1 subscription of this topic. Bellow is a subscription parameters.
You can use this script for that.
First, you would rcv is 2 and prc is 0. Expected, as we allowed only 2 messages being processed (passed into message callback) by flow control. Then, prc becoming 2 (as 2 second timeout reached and we acked the message) and rcv is 4. Such stepped processing and updates should happen each 2 seconds. But, after some time, somehere in the range of maxExtension period deadline (when pubsub starting either extending messages periods or removing them from internal queue), rcv counter jumps up to 100, while prc is still 4, 6 or 8 depends when it happen, but the number is always small and smaller then 20, even 15.
bandicam.2021-02-17.21-50-32-285.mp4
This leads to falling assumption that, for example k8s pod which processing the messages and have resources limits by CPU or MEM might be evicted because it would try to process all the messages and would reach resources limits (would be throttled by CPU or Killed because of memory limits).
Now, where it is happeing.
I've added logs into library, so I definitely see that it following though
_extendDeadlines
in lease-manager.ts.Through else path in for loop, and calling
this.remove(message)
;And in remove it starting constantly falling into
this.pending > 0
condition and dispensing current message (which actually already expired and should be redelivered by pubsub). It's obvious here, that such message should not be dispensed to the client code.I'm not sure how to fix this in pubsub lib code, either as I don't think that there is a proper workaround for the client code (ours, as we are relying that flow control would be met).
The text was updated successfully, but these errors were encountered: