DEADLINE_EXCEEDED
cloud
runtime_error
ai_generated
true
DEADLINE_EXCEEDED: The deadline expired before the operation could complete. gRPC stream closed with status code 4
ID: cloud/gcp-pubsub-subscription-pull-ack-deadline-exceeded
82%Fix Rate
85%Confidence
1Evidence
2024-02-15First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| gcloud_cli | active | — | — | — |
| pubsub_api | active | — | — | — |
| client_library | active | — | — | — |
Root Cause
Pub/Sub subscriber's ack deadline is too short for message processing, causing the gRPC streaming pull to close after repeated deadline violations.
generic中文
Pub/Sub 订阅者的确认截止时间太短,无法完成消息处理,导致 gRPC 流式拉取在多次截止时间违规后关闭。
Official Documentation
https://cloud.google.com/pubsub/docs/pull#streamingpullWorkarounds
-
90% success Increase the ack deadline for the subscription: `gcloud pubsub subscriptions update my-sub --ack-deadline=600` (10 minutes). Ensure your message processing completes within this window.
Increase the ack deadline for the subscription: `gcloud pubsub subscriptions update my-sub --ack-deadline=600` (10 minutes). Ensure your message processing completes within this window.
-
95% success Implement a manual ack extension loop in your subscriber: after receiving a message, call `subscriber.modifyAckDeadline(message, 60)` every 30 seconds until processing is done, then ack. Example: `from google.cloud import pubsub_v1; subscriber.modify_ack_deadline(subscription, [message.ack_id], 60)`
Implement a manual ack extension loop in your subscriber: after receiving a message, call `subscriber.modifyAckDeadline(message, 60)` every 30 seconds until processing is done, then ack. Example: `from google.cloud import pubsub_v1; subscriber.modify_ack_deadline(subscription, [message.ack_id], 60)`
中文步骤
Increase the ack deadline for the subscription: `gcloud pubsub subscriptions update my-sub --ack-deadline=600` (10 minutes). Ensure your message processing completes within this window.
Implement a manual ack extension loop in your subscriber: after receiving a message, call `subscriber.modifyAckDeadline(message, 60)` every 30 seconds until processing is done, then ack. Example: `from google.cloud import pubsub_v1; subscriber.modify_ack_deadline(subscription, [message.ack_id], 60)`
Dead Ends
Common approaches that don't work:
-
75% fail
Adding more subscribers doesn't fix the ack deadline; each message still has the same processing time limit.
-
60% fail
Synchronous pull has its own timeout issues and doesn't inherently increase ack deadline.