Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

What can cause pub/sub stops sending message to subscriber?

Sorry if this wrong place to ask. I have async golang microservice that subscribe to pub/sub topic i use, after i deploying it i saw that there was 1 message that didn't get Ack and after that pub/sub stopped sending messages to the subscriber entirely, checked the log there is no error in the log.  So yeah I want to know what could ve caused pub/sub to stop sending messages when the subscriber seemed fine?

Thank You

Solved Solved
0 2 6,147
1 ACCEPTED SOLUTION

There can be a few reasons why your Pub/Sub subscription might have stopped receiving messages:

  • The subscription was deleted: If the subscription is deleted, it will no longer receive messages from its associated topic.
  • The subscriber was disconnected from the Pub/Sub service: Network or application issues might have caused the subscriber to disconnect.
  • The subscriber exceeded its maximum outstanding messages: If the subscriber has too many unacknowledged messages, it may stop receiving new ones.
  • Accumulation of unacknowledged messages: If messages aren't being pulled or acknowledged, they will accumulate in the subscription. Once the message retention duration is reached, these messages will be deleted.
  • The subscriber exceeded its acknowledge deadline: The acknowledge deadline is the amount of time that the subscriber has to acknowledge a message. If the subscriber does not acknowledge a message within this timeframe, Pub/Sub considers the message unacknowledged and will attempt to redeliver it.

If you are uncertain about the root cause, you can utilize Pub/Sub monitoring tools for insights. These tools can provide information about the subscription's state, including the number of messages published to the subscription, the number of messages delivered to the subscriber, and the number of unacknowledged messages.

In your situation, it appears that the subscriber exceeding its acknowledge deadline is the most probable cause. To mitigate this:

  • Increase the acknowledge deadline: This gives the subscriber more time to process and acknowledge messages.
  • Reduce the rate of message delivery: Adjusting the flow control settings can help manage the rate at which messages are delivered to the subscriber.
  • Optimize message processing: Ensure that the subscriber processes messages efficiently to prevent buildup.
  • Consider using another message queuing system in conjunction with Pub/Sub: This can act as an additional buffer, but ensure you understand the benefits and trade-offs of this approach.

If you're looking to address the buildup of unacknowledged messages in the existing subscription, you'd need to either acknowledge the messages or wait for them to expire based on the message retention duration. Creating a new subscription to the topic would start from the current point in time and would not inherit the backlog of the previous subscription.

View solution in original post

2 REPLIES 2

There can be a few reasons why your Pub/Sub subscription might have stopped receiving messages:

  • The subscription was deleted: If the subscription is deleted, it will no longer receive messages from its associated topic.
  • The subscriber was disconnected from the Pub/Sub service: Network or application issues might have caused the subscriber to disconnect.
  • The subscriber exceeded its maximum outstanding messages: If the subscriber has too many unacknowledged messages, it may stop receiving new ones.
  • Accumulation of unacknowledged messages: If messages aren't being pulled or acknowledged, they will accumulate in the subscription. Once the message retention duration is reached, these messages will be deleted.
  • The subscriber exceeded its acknowledge deadline: The acknowledge deadline is the amount of time that the subscriber has to acknowledge a message. If the subscriber does not acknowledge a message within this timeframe, Pub/Sub considers the message unacknowledged and will attempt to redeliver it.

If you are uncertain about the root cause, you can utilize Pub/Sub monitoring tools for insights. These tools can provide information about the subscription's state, including the number of messages published to the subscription, the number of messages delivered to the subscriber, and the number of unacknowledged messages.

In your situation, it appears that the subscriber exceeding its acknowledge deadline is the most probable cause. To mitigate this:

  • Increase the acknowledge deadline: This gives the subscriber more time to process and acknowledge messages.
  • Reduce the rate of message delivery: Adjusting the flow control settings can help manage the rate at which messages are delivered to the subscriber.
  • Optimize message processing: Ensure that the subscriber processes messages efficiently to prevent buildup.
  • Consider using another message queuing system in conjunction with Pub/Sub: This can act as an additional buffer, but ensure you understand the benefits and trade-offs of this approach.

If you're looking to address the buildup of unacknowledged messages in the existing subscription, you'd need to either acknowledge the messages or wait for them to expire based on the message retention duration. Creating a new subscription to the topic would start from the current point in time and would not inherit the backlog of the previous subscription.

Ah, i see thank you very much, it seems your guess is correct. Increasing the ack deadline as temporary measure seems to solve the issue.