Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix multiple messages from Push Subscription in GCP Pub/sub

I have a Cloud Pub/Sub Push subscription that pushes multiple instances of the same messages to a processing end-point i GAE. I can track the message ID and it’s the same message that gets PUSH multiple times.

I have set the ack-timeout to 600 seconds but still it pushes multiple instances of some of the messages. Outside of the message doesn’t get “acked”, what can trigger this behavior? Anyone had the same problem?

The issue seems to be bigger the more instances I run, but even when using basic_scaling and with max_instances: 1 problem still remains.

I can see a bunch of 503 errors in GAE but if I understand it correct, that is not an issue since these messages automatically gets "re-tried" but Pub/Sub.

like image 618
cjt Avatar asked Nov 01 '25 15:11

cjt


1 Answers

I am posting this as an answer, because i dont have enough reputation to put as comment. :)

As you have already figured out, once Pub/Sub sends a message to a subscriber, the subscriber should acknowledge the message. Any message that has not been acknowledged, Cloud Pub/Sub will repeatedly attempt to deliver (Check here). This means that occasional duplicates are to be expected. However, a high rate of duplicates may indicate that the client is not acknowledging messages within the configured ack_deadline_seconds, and Cloud Pub/Sub is retrying the message delivery. You could use Stackdriver, to monitor if the Pub/Sub System is successful and your messages are being acknowledged (Check here & here), or if there are too many duplicates (Check here & here).

like image 159
Artemis Georgakopoulou Avatar answered Nov 04 '25 20:11

Artemis Georgakopoulou



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!