Skip to content

Commit 1991b18

Browse files
committed
address rest of comments
1 parent a8841a3 commit 1991b18

File tree

1 file changed

+35
-33
lines changed

1 file changed

+35
-33
lines changed

sdk/servicebus/azure-servicebus/TROUBLESHOOTING.md

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,32 @@ This troubleshooting guide contains instructions to diagnose frequently encounte
77
* [General troubleshooting](#general-troubleshooting)
88
* [Enable client logging](#enable-client-logging)
99
* [Common exceptions](#common-exceptions)
10+
* [Authentication Exceptions](#authentication-exceptions)
11+
* [Connection and Timeout Exceptions](#connection-and-timeout-exceptions)
12+
* [Message and Session Handling Exceptions](#message-and-session-handling-exceptions)
13+
* [Service and Entity Exceptions](#service-and-entity-exceptions)
14+
* [Auto Lock Renewal Exceptions](#auto-lock-renewal-exceptions)
1015
* [Threading and concurrency issues](#threading-and-concurrency-issues)
1116
* [Thread safety limitations](#thread-safety-limitations)
12-
* [Async/await best practices](#asyncawait-best-practices)
13-
* [Authentication issues](#authentication-issues)
14-
* [Authentication errors](#authentication-errors)
15-
* [Authorization errors](#authorization-errors)
16-
* [Connection string issues](#connection-string-issues)
17-
* [Connectivity issues](#troubleshooting-connectivity-issues)
18-
* [Connection errors](#connection-errors)
19-
* [Firewall and proxy issues](#firewall-and-proxy-issues)
20-
* [Service busy errors](#service-busy-errors)
17+
* [Troubleshooting Authentication issues](#troubleshooting-authentication-issues)
18+
* [Troubleshooting Connectivity issues](#troubleshooting-connectivity-issues)
19+
* [Timeout when connecting to service](#timeout-when-connecting-to-service)
20+
* [SSL handshake failures](#ssl-handshake-failures)
21+
* [Adding components to the connection string does not work](#adding-components-to-the-connection-string-does-not-work)
22+
* ["TransportType.AmqpOverWebSocket" Alternative](#transporttypeamqpoverwebsocket-alternative)
23+
* [Azure Identity Authentication Alternative](#azure-identity-authentication-alternative)
2124
* [Troubleshooting message handling issues](#troubleshooting-message-handling-issues)
22-
* [Message lock issues](#message-lock-issues)
25+
* [Message and session lock issues](#message-and-session-lock-issues)
2326
* [Message size issues](#message-size-issues)
24-
* [Message settlement issues](#message-settlement-issues)
25-
* [Troubleshooting session handling issues](#troubleshooting-session-handling-issues)
26-
* [Session lock issues](#session-lock-issues)
27-
* [Session cannot be locked](#session-cannot-be-locked)
2827
* [Troubleshooting receiver issues](#troubleshooting-receiver-issues)
2928
* [Number of messages returned doesn't match number requested](#number-of-messages-returned-doesnt-match-number-requested)
3029
* [Mixing sync and async code](#mixing-sync-and-async-code)
3130
* [Dead letter queue issues](#dead-letter-queue-issues)
3231
* [Quotas](#quotas)
32+
* [Entity not found errors](#entity-not-found-errors)
3333
* [Troubleshooting async operations](#troubleshooting-async-operations)
3434
* [Get additional help](#get-additional-help)
35+
* [Filing GitHub issues](#filing-github-issues)
3536

3637
## General troubleshooting
3738

@@ -76,38 +77,40 @@ ServiceBusErrors often have an underlying AMQP error code which specifies whethe
7677
* `retry_mode`: The delay behavior between retry attempts. Supported values are 'fixed' or 'exponential'
7778
When an exception is surfaced to the application, either all retries were applied unsuccessfully, or the exception was considered non-transient.
7879

79-
#### Connection and Authentication Exceptions
80-
81-
- **ServiceBusConnectionError:** An error occurred in the connection to the se
82-
rvice. This may have been caused by a transient network issue or service proble
83-
m. It is recommended to retry.
80+
#### Authentication Exceptions
8481

8582
- **ServiceBusAuthenticationError:** An error occurred when authenticating the connection to the service. This may have been caused by the credentials being incorrect. It is recommended to check the credentials.
8683

8784
- **ServiceBusAuthorizationError:** An error occurred when authorizing the connection to the service. This may have been caused by the credentials not having the right permission to perform the operation. It is recommended to check the permission of the credentials.
8885

89-
#### Operation and Timeout Exceptions
86+
See the [Troubleshooting Authentication issues](#troubleshooting-authentication-issues) section to troubleshoot authentication/permission issues.
87+
88+
#### Connection and Timeout Exceptions
89+
90+
- **ServiceBusConnectionError:** An error occurred in the connection to the service. This may have been caused by a transient network issue or service problem. It is recommended to retry.
9091

9192
- **OperationTimeoutError:** This indicates that the service did not respond to an operation within the expected amount of time. This may have been caused by a transient network issue or service problem. The service may or may not have successfully completed the request; the status is not known. It is recommended to attempt to verify the current state and retry if necessary.
9293

9394
- **ServiceBusCommunicationError:** Client isn't able to establish a connection to Service Bus. Make sure the supplied host name is correct and the host is reachable. If your code runs in an environment with a firewall/proxy, ensure that the traffic to the Service Bus domain/IP address and ports isn't blocked. For details on which ports need to be open, see the [Azure Service Bus FAQ: What ports do I need to open on the firewall?](https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-faq#what-ports-do-i-need-to-open-on-the-firewall--).
9495

95-
#### Message Handling Exceptions
96+
See the [Troubleshooting Connectivity issues](#troubleshooting-connectivity-issues) section to troubleshoot connection and timeout issues. More information on AMQP errors in Azure Service Bus can be found [here](https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-amqp-troubleshoot).
97+
98+
#### Message and Session Handling Exceptions
9699

97100
- **MessageSizeExceededError:** This indicates that the max message size has been exceeded. The message size includes the body of the message, as well as any associated metadata and system overhead. The best approach for resolving this error is to reduce the number of messages being sent in a batch or the size of the body included in the message. Because size limits are subject to change, please refer to [Service Bus quotas](https://learn.microsoft.com/azure/service-bus-messaging/service-bus-quotas) for specifics.
98101

99102
- **MessageAlreadySettled:** This indicates failure to settle the message. This could happen when trying to settle an already-settled message.
100103

101-
- **MessageLockLostError:** Indicates that the lock on the message is lost. Callers should attempt to receive and process the message again. This exception only applies to entities that don't use sessions. This error occurs if processing takes longer than the lock duration and the message lock isn't renewed. This error can also occur when the link is detached due to a transient network issue or when the link is idle for 10 minutes, as enforced by the service. `AutoLockRenewer` could help on keeping the lock of the message automatically renewed.
102-
103104
- **MessageNotFoundError:** This occurs when attempting to receive a deferred message by sequence number for a message that either doesn't exist in the entity, or is currently locked.
104105

105-
#### Session Handling Exceptions
106+
- **MessageLockLostError:** Indicates that the lock on the message is lost. Callers should attempt to receive and process the message again. This exception only applies to entities that don't use sessions. This error occurs if processing takes longer than the lock duration and the message lock isn't renewed. This error can also occur when the link is detached due to a transient network issue or when the link is idle for 10 minutes, as enforced by the service. `AutoLockRenewer` could help on keeping the lock of the message automatically renewed.
106107

107108
- **SessionLockLostError:** The lock on the session has expired. All unsettled messages that have been received can no longer be settled. It is recommended to reconnect to the session if receive messages again if necessary. You should be aware of the lock duration of a session and keep renewing the lock before expiration in case of long processing time. `AutoLockRenewer` could help on keeping the lock of the session automatically renewed.
108109

109110
- **SessionCannotBeLockedError:** Attempt to connect to a session with a specific session ID, but the session is currently locked by another client. Make sure the session is unlocked by other clients.
110111

112+
See the [Troubleshooting message handling issues](#troubleshooting-message-handling-issues) section to troubleshoot message and session lock issues.
113+
111114
#### Service and Entity Exceptions
112115

113116
- **ServiceBusQuotaExceededError:** This typically indicates that there are too many active receive operations for a single entity. In order to avoid this error, reduce the number of potential concurrent receives. You can use batch receives to attempt to receive multiple messages per receive request. Please see [Service Bus quotas](https://learn.microsoft.com/azure/service-bus-messaging/service-bus-quotas) for more information.
@@ -124,6 +127,8 @@ m. It is recommended to retry.
124127

125128
- **AutoLockRenewTimeout:** The time allocated to renew the message or session lock has elapsed. You could re-register the object that wants be auto lock renewed or extend the timeout in advance.
126129

130+
See the [Troubleshooting message handling issues](#troubleshooting-message-handling-issues) to help troubleshoot AutoLockRenewer errors.
131+
127132
## Threading and concurrency issues
128133

129134
### Thread safety limitations
@@ -199,7 +204,7 @@ with client:
199204
executor.submit(send_batch, i, sender)
200205
```
201206

202-
## Authentication issues
207+
## Troubleshooting Authentication issues
203208

204209
Authentication errors typically occur when the credentials provided are incorrect or have expired. Authorization errors occur when the authenticated identity doesn't have sufficient permissions.
205210

@@ -211,7 +216,7 @@ The following verification steps are recommended, depending on the type of autho
211216

212217
- [Verify the correct RBAC roles were granted](https://learn.microsoft.com/azure/service-bus-messaging/service-bus-managed-service-identity) - Indicated by errors: `Send/Listen claim(s) are required to perform this operation.` In this case, ensure that the appropriate roles were assigned: `Azure Service Bus Data Owner`, `Azure Service Bus Data Sender`, or `Azure Service Bus Data Receiver`.
213218

214-
## Connectivity issues
219+
## Troubleshooting Connectivity issues
215220

216221
### Timeout when connecting to service
217222

@@ -251,11 +256,11 @@ For more information about the `azure-identity` library, see: [Azure Identity cl
251256

252257
## Troubleshooting message handling issues
253258

254-
### Message lock issues
259+
### Message and session lock issues
255260

256-
Messages in Service Bus have a lock duration during which they must be settled (completed, abandoned, etc.).
261+
Messages, sessionful and non-sessionful, in Service Bus have a lock duration during which they must be settled (completed, abandoned, etc.).
257262

258-
**MessageLockLostError resolution:**
263+
**MessageLockLostError and SessionLockLostError resolution:**
259264
1. Process messages faster or increase lock duration
260265
2. If setting `prefetch_count` to a large number, consider setting it lower as it can cause message lock expiration if processing takes too long. The client cannot extend locks for prefetched messages.
261266
3. Use `AutoLockRenewer` for long-running processing.
@@ -273,8 +278,6 @@ with receiver:
273278
receiver.complete_message(message)
274279
```
275280

276-
3. Handle lock lost errors gracefully by catching the exception and potentially re-receiving the message
277-
278281
### Message size issues
279282

280283
**MessageSizeExceededError resolution:**
@@ -359,8 +362,7 @@ def continuous_message_processing(receiver):
359362

360363
### Mixing sync and async code
361364

362-
Mixing synchronous and asynchronous Service Bus operations can cause issues such as async operations hanging indefinitely due to the event loop being blocked. Ensure that blocking calls are not made when receiving and message processing.
363-
365+
Mixing synchronous and asynchronous Service Bus operations can cause issues such as async operations, such as the `AutoLockRenewer`, hanging indefinitely due to the event loop being blocked. Ensure that blocking calls are not made when receiving and message processing.
364366

365367
### Dead letter queue issues
366368

0 commit comments

Comments
 (0)