Skip to content
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

Random DEADLINE_EXCEEDED errors emitted for modifyAckDeadline and acknowledge #568

Closed
mkls opened this issue Apr 8, 2019 · 11 comments
Closed
Assignees
Labels
api: pubsub Issues related to the googleapis/nodejs-pubsub API. type: question Request for information or clarification. Not an issue.

Comments

@mkls
Copy link
Contributor

mkls commented Apr 8, 2019

Environment details

  • OS: Ubuntu 18.04
  • Node.js version: 10.11.0
  • npm version: 6.5.0
  • @google-cloud/pubsub version: 0.28.1

We are processing about 300 messages per second from a subscription, and about once or twice a day we randomly get DEADLINE_EXCEEDED errors emitted like these:

Failed to "acknowledge" for 55 message(s). Reason: 4 DEADLINE_EXCEEDED: Deadline Exceeded
and
Failed to "modifyAckDeadline" for 63 message(s). Reason: 4 DEADLINE_EXCEEDED: Deadline Exceeded

Steps to reproduce

A minimal setup is something like this:

const subscription = new PubSub({...}).subscription(subscriptionName);
subscription.on(`message`, message => processMessage());
subscription.on(`error`, error => console.log(error));

Our processMessage function usually takes around 150ms to run, with highest peaks of 1500ms.

The acknowledgement deadline for the subscription in cloud console is set to 600 seconds.

We've looked through similar issues and tried experimenting with setting

      batching: {
        callOptions: {
          timeout: 600000
        }
      }

as a subscription option as described in #240.

Also tried setting the ackDeadline subscription option, but neither of them seemed to help.

We've also looked through the source code of this repo, but couldn't figure out much, other than these errors come from MessageQueues for ack and nack messages, and seem to be coming through google-gax from somewhere in grpc.

Locally I can make the client emit these errors, if I set { batching: { callOptions: { timeout: 1 }}}, but in production this value is set to a much higher value.

We could just ignore these errors, but it would feel better if someone could give some tips on how to find the root cause or what could be going wrong .

@bcoe bcoe added the type: question Request for information or clarification. Not an issue. label Apr 8, 2019
@kir-titievsky
Copy link

These are safe to ignore as these are retry-able errors. Ideally we should hide these behind a higher level logging flag.

@jkwlui jkwlui closed this as completed Apr 16, 2019
@pjm17971
Copy link

pjm17971 commented Jun 21, 2019

@jkwlui I'm not sure this should be closed as this should ideally be handled internally. For us these errors cause the subscription on close() handler to be called after the on error() handler is called with the DEADLINE_EXCEEDED message. This puts the application in a state of not receiving messages at all. This was actually somewhat hard to detect on our end and cost a non-trivial amount of time to identify the problem (the unhandled exception was in the log messages, but it was a needle in a haystack).

In the mean time, can you advise on how to retry something after the close() unexpected exit handler is called? (or to do something in the error() handler to prevent the exit?) Currently we just exit the process and let Kubernetes recreate the pod. If there's a cleaner way to handle this it would be helpful to know. Also, if this is known behavior, then perhaps the example code for handling subscriptions should include these cases and how to correctly respond, since I'm assume most pubsub use is long running.

@filipsuk
Copy link

We are still facing the same issue, have you found any workarounds @mkls @pjm17971 ?

@kir-titievsky
Copy link

kir-titievsky commented Sep 27, 2019 via email

@mahaben
Copy link

mahaben commented Oct 3, 2019

We are facing the same issue, this error puts the app in a state of not receiving messages at all. Any workaround?

Thanks,

@callmehiphop
Copy link
Contributor

@mahaben while this error can be frustrating, I am pretty concerned to hear that it puts your application into that kind of state. Might I trouble you for some additional details?

Are you seeing an uncaught exception/unhandled rejection when this error occurs?
How many subscription objects do you have open in your application?
Are you setting any custom flow control settings on the subscription?
Roughly how many pending messages do you have on your topic?

@bcoe bcoe reopened this Oct 9, 2019
@filipsuk
Copy link

This happened to us mainly when doing CPU intensive work while processing task queue from pubsub.

However I found a suitable workaround, using the general library fixed the issue for me https://github.com/googleapis/google-api-nodejs-client

@callmehiphop
Copy link
Contributor

I think this is probably a duplicate of #770 so I'm going to close this out. If anyone feels that this is an error, let us know and we'll be happy to re-open.

@google-cloud-label-sync google-cloud-label-sync bot added the api: pubsub Issues related to the googleapis/nodejs-pubsub API. label Jan 31, 2020
@shoxsz
Copy link

shoxsz commented Mar 23, 2022

I'm still getting this error, and since I don't know a better place to post this, I'm posting it here.
I'm getting this errors: Failed to "modifyAckDeadline" for 33 message(s). Reason: 4 DEADLINE_EXCEEDED: Deadline exceeded and Failed to "acknowledge" for 1 message(s). Reason: 4 DEADLINE_EXCEEDED: Deadline exceeded, so basically, I can't ack/nack messages, and they keep being pushed many times.

This looks like an error from the pubsub api server, I don't know what this error means and I found this docs: https://cloud.google.com/pubsub/docs/reference/error-codes which does have some explanation for the DEADLINE_EXCEEDED error, but I'm not sure if it's the same thing.

I'm using pubusb version "@google-cloud/pubsub": "^2.18.4"

@mmmmillar
Copy link

Still seeing this issue in 2023 with @google-cloud/pubsub": "^3.0.3

Could we reopen this? @callmehiphop

@callmehiphop
Copy link
Contributor

Still seeing this issue in 2023 with @google-cloud/pubsub": "^3.0.3

Could we reopen this? @callmehiphop

^ @bcoe (I assume you're still here??)

feywind pushed a commit to feywind/nodejs-pubsub that referenced this issue Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: pubsub Issues related to the googleapis/nodejs-pubsub API. type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

10 participants