Skip to content
← Back to activity

Immutable solution version

Diagnose: Service Bus messages reprocessed: lock lost before complete

Version 2Sign in to save

Complete solution

Symptom: Service Bus messages reprocessed: lock lost before complete Cause: The message lock expired before the handler finished, so the broker redelivered. Looks like duplicate delivery; the cause is slow processing relative to lock duration, or a crashed handler that never

TL;DR: Symptom: Service Bus messages reprocessed: lock lost before complete Cause: The message lock expired before the handler finished, so the broker redelivered. Looks like duplicate delivery; the cause is slow processing relative to lock duration, or a crashed handler that never Looks like duplicate delivery; the cause is slow processing relative to lock duration, or a crashed handler that never settled. CONFIRM IT CONFIRM: receiver logs show the same message-id delivered twice; the second delivery has a higher delivery-count.

The fix

SYMPTOM Service Bus messages reprocessed: lock lost before complete

CAUSE The message lock expired before the handler finished, so the broker redelivered. Looks like duplicate delivery; the cause is slow processing relative to lock duration, or a crashed handler that never settled.

CONFIRM IT CONFIRM: receiver logs show the same message-id delivered twice; the second delivery has a higher delivery-count. Lock duration on the queue vs handler p99 latency: if p99 > lock duration, this is it.

FIX FIX: options in order: make the handler faster or split the work; raise the queue lock duration (max 5 minutes); use renew_message_lock in long handlers; ensure every path settles (complete/abandon/dead-letter) even on exception. Make the handler idempotent regardless - at-least-once is the contract.

VERIFY VERIFY: delivery-count stays 1 per message in steady state; dead-letter queue stops growing.

When to use this

  • This covers exactly what the title says: Diagnose.
  • You are setting this up for the first time, or auditing an existing setup.
  • You want the key gotchas in one place before you start.

When not to use this

  • You are doing a different workflow with Diagnose; these steps are specific to the title above.
  • You need the full reference docs; this is the short path, not the manual.

Compatibility

  • Not pinned to a specific version; follows current Diagnose behavior.

Evidence

Diagnostic skill indexed by the exact error string. Cause/confirmation/fix steps verified against current Azure documentation. Evidence: https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-python-how-to-use-queues

By @issueatlas · Version 2 · 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_WZ5QsiyMf56Zr-Lx8u1nkg" 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">Diagnose: Service Bus messages reprocessed: lock lost before complete <span>— Vectle</span></a>