Cloud

Azure Service Bus: diagnose a blocked session before resuming consumers

A production runbook for separating session locks, failed messages and business state before resuming ordered Azure Service Bus processing.

23 Nov 2026 azureservice-busmessagingautomationobservabilityrunbookrollbackproduction

An order pipeline uses one Service Bus session per order to process events in sequence. Backlog grows for some orders while others continue normally. Restarting every consumer or replaying the dead-letter queue may make recovery harder: a business action may have succeeded before the lock was lost, or a missing event may make later transitions unsafe.

The goal is to qualify one affected session, protect business ordering and resume a single flow under observation. The evidence below is an example application contract, not a claim that Service Bus supplies every field automatically.

Contain and define the scope

Pause automatic retries for the affected consumer using the controls available, without purging the queue or moving messages. Assign an incident owner and record the namespace, queue or subscription, UTC window, deployed version and protected session and message identifiers. Keep sensitive payloads out of the ticket.

A global pause can affect healthy sessions. Assess that impact, and use a targeted pause only if the system actually guarantees it. Confirm downstream capacity and the acceptable duration of the pause.

Reconstruct one session end to end

Correlate producer, consumer and business-system evidence for an affected order:

EvidenceQuestion
SessionId, MessageId, SequenceNumber, enqueue timeWhich event was expected and which was actually received?
Instance, session acquisition and loss, renewals, errorsDoes a consumer still hold the lock, or has it lost it?
Processing start and end, settlement, DeliveryCountDid the business effect happen before confirmation failed?
Business state, idempotency key and any session stateWhich transition is durable and which remains uncertain?
Active and dead-lettered messages, failure reasonIs an earlier event missing ahead of later ones?

Use application traces and authorized read operations. A non-destructive peek is evidence, not a complete transactional snapshot; inspecting a specific session can itself require acquiring it. Do not take the lock from an active session merely to observe it. A global backlog metric does not identify the responsible session.

Only one receiver holds a session lock at a time, but the lock does not make an external API call atomic with message settlement. After lock loss, the old handler may still cause a side effect unless the application stops it. Microsoft documents the scope and lifecycle of session locks.

Separate causes before acting

  • Lock held, work progressing: allow completion if the delay is acceptable and set a reassessment time. A live lock alone is not proof of progress.
  • Long processing or interrupted renewal: compare duration, renewals, saturation and dependencies. Link loss can also cause lock loss before the apparent expiry; a longer duration is not necessarily the fix. See lock troubleshooting.
  • Failed or dead-lettered message: qualify the contract, failure reason and effects already committed. Once maximum deliveries are exceeded, later messages can be received, but their processing may not be a valid business transition.
  • Inconsistent session state: compare it with the authoritative business record. This opaque application state can remain after messages are consumed; do not clear it merely to unblock the flow.

Service Bus delivers session messages in order, but an application processing several concurrently must preserve the order of its own effects. A message resubmitted from the dead-letter queue receives a new enqueue order: replay does not automatically restore the original sequence.

Choose a bounded recovery

Before resuming, record the last confirmed event, missing events, each known effect and the business owner. Isolate or gracefully stop the former consumer and prove it cannot produce competing effects. If that, downstream state or deduplication remains uncertain, keep the pause and reconcile first.

Then choose one approved action: wait for the holder to finish, fix the failure, or use an explicit business repair procedure for missing events. Do not bulk-replay the DLQ or change session state or delivery limits as a shortcut. If replay is necessary, agree the business order and compensation strategy with the owner; retaining an identifier alone does not guarantee freedom from duplicates.

Canary, validation and rollback

Allow one consumer and one representative session only if the system can actually enforce that scope. Otherwise test in an isolated environment with test messages and dependencies, then plan a monitored production resumption bounded by a proven control. Do not describe unverified targeting as isolation.

Set acceptance criteria before resuming: ordered business transitions, no duplicate downstream effect, confirmed settlement, stable lock ownership and no new dead-lettered messages. Compare identifiers and business state before and after; an emptying queue is not sufficient. Expand gradually with the owner’s approval.

If the canary loses its lock, applies an unexpected transition or creates a duplicate, pause the affected consumers again and preserve evidence. Stopping does not undo committed effects: use the approved business compensation and reconcile before another attempt. The final decision is either a gradual resumption or a continued pause with a named owner and reassessment deadline.