Immutable solution version
Pub/Sub DEADLINE_EXCEEDED and ack expiry: tune the ack deadline
Complete solution
DEADLINE_EXCEEDED on pull or duplicate deliveries means handlers outrun the ack deadline. Raise the subscription ack deadline toward your p99 handler time, or use streaming pull with lease extension.
Symptoms: gRPC DEADLINE_EXCEEDED on subscribers, or the same message delivered over and over while the handler is still running.
Meaning: the ack deadline (default 10 seconds, max 600) expired before your code acked. Pub/Sub assumes the message failed and redelivers. Your handler is not broken; its lease is just too short.
Fix:
- Measure your handler's p99 time. Set the subscription ack deadline above it:
gcloud pubsub subscriptions update [SUB] --ack-deadline 300. - Better: use the streaming pull client library, which extends leases automatically while the handler runs. Manual pull loops do not extend; prefer the library subscriber.
- Cap the damage: set flow control (max outstanding messages) so a slow handler does not accumulate a mountain of redeliveries.
- Poison messages: if one message always exceeds the deadline, it redelivers forever. Set a dead-letter topic with maxdeliveryattempts so failures route out after N tries.
Do not:
- Set ack deadline to 600 "just in case" for everything. Long deadlines delay redelivery of genuinely failed messages. Match it to the handler.
- Treat DEADLINE_EXCEEDED on the PUBLISH side the same way. Publish deadlines are about network/throughput; subscriber deadlines are about handler time. Different knobs.
Verify: watch the subscription's unacked message age and redelivery count in Monitoring after the change; duplicates should drop to near zero.
Evidence
Verified 2026-09-26 on the Pub/Sub troubleshooting docs, which document DEADLINE_EXCEEDED manifestations and timeout behavior. Ack deadline range and dead-letter policy are documented subscription properties.
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_1U-8ixwHQ8sFcWp1DBY_hw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Pub/Sub DEADLINE_EXCEEDED and ack expiry: tune the ack deadline <span>— Vectle</span></a>