You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -38,15 +38,15 @@ This troubleshooting guide contains instructions to diagnose frequently encounte
38
38
39
39
## General troubleshooting
40
40
41
-
Azure Service Bus client library will raise exceptions defined in [Azure Core](https://aka.ms/azsdk/python/core/docs#module-azure.core.exceptions) and [azure.servicebus.exceptions](https://docs.microsoft.com/python/api/azure-servicebus/azure.servicebus.exceptions).
41
+
Azure Service Bus client library will raise exceptions defined in [Azure Core](https://aka.ms/azsdk/python/core/docs#module-azure.core.exceptions) and Service Bus-specific exceptions in `azure.servicebus.exceptions`.
42
42
43
43
### Enable client logging
44
44
45
45
This library uses the standard [logging](https://docs.python.org/3/library/logging.html) library for logging.
46
46
47
-
Basic information about HTTP sessions (URLs, headers, etc.) is logged at `INFO` level.
47
+
Basic information about AMQP operations (connections, links, etc.) is logged at `INFO` level.
48
48
49
-
Detailed `DEBUG` level logging, including request/response bodies and **unredacted** headers, can be enabled on the client or per-operation with the `logging_enable` keyword argument.
49
+
Detailed `DEBUG` level logging, including AMQP frame tracing and **unredacted** headers, can be enabled on the client or per-operation with the `logging_enable` keyword argument.
50
50
51
51
To enable client logging and AMQP frame level trace:
52
52
@@ -73,81 +73,42 @@ See full Python SDK logging documentation with examples [here](https://learn.mic
73
73
74
74
### Common exceptions
75
75
76
-
The Service Bus APIs generate the following exceptions in `azure.servicebus.exceptions`:
76
+
The Service Bus client library raises the following exceptions defined in `azure.servicebus.exceptions`:
77
77
78
78
#### Connection and Authentication Exceptions
79
79
80
-
-**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.
81
-
82
-
-**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.
83
-
84
-
-**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.
80
+
-**ServiceBusConnectionError:** Connection to the service failed. Check network connectivity and retry.
81
+
-**ServiceBusAuthenticationError:** Authentication failed. Verify credentials are correct.
82
+
-**ServiceBusAuthorizationError:** Authorization failed. Check that credentials have the required permissions.
85
83
86
84
#### Operation and Timeout Exceptions
87
85
88
-
-**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.
89
-
90
-
-**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 information about required ports, see [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--).
86
+
-**OperationTimeoutError:** Service did not respond within the expected time. Retry the operation.
87
+
-**ServiceBusCommunicationError:** Unable to establish connection to Service Bus. Check network connectivity and firewall settings. For firewall configuration, see [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--).
91
88
92
89
#### Message Handling Exceptions
93
90
94
-
-**MessageSizeExceededError:** This indicates that the message content is larger than the service bus frame size. This could happen when too many service bus messages are sent in a batch or the content passed into the body of a `Message` is too large. It is recommended to reduce the count of messages being sent in a batch or the size of content being passed into a single `ServiceBusMessage`.
95
-
96
-
-**MessageAlreadySettled:** This indicates failure to settle the message. This could happen when trying to settle an already-settled message.
97
-
98
-
-**MessageLockLostError:** The lock on the message has expired and it has been released back to the queue. It will need to be received again in order to settle it. You should be aware of the lock duration of a message and keep renewing the lock before expiration in case of long processing time. `AutoLockRenewer` could help on keeping the lock of the message automatically renewed.
99
-
100
-
-**MessageNotFoundError:** Attempt to receive a message with a particular sequence number. This message isn't found. Make sure the message hasn't been received already. Check the deadletter queue to see if the message has been deadlettered.
-**MessageAlreadySettled:** Attempt to settle an already-settled message.
93
+
-**MessageLockLostError:** Message lock expired. Use `AutoLockRenewer` or process messages faster.
94
+
-**MessageNotFoundError:** Message with specified sequence number not found. Check if message was already processed.
101
95
102
96
#### Session Handling Exceptions
103
97
104
-
-**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.
105
-
106
-
-**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.
98
+
-**SessionLockLostError:** Session lock expired. Reconnect to the session or use `AutoLockRenewer`.
99
+
-**SessionCannotBeLockedError:** Session is locked by another client. Wait for lock to expire.
107
100
108
101
#### Service and Entity Exceptions
109
102
110
-
-**ServiceBusQuotaExceededError:** The messaging entity has reached its maximum allowable size, or the maximum number of connections to a namespace has been exceeded. Create space in the entity by receiving messages from the entity or its subqueues.
111
-
112
-
-**ServiceBusServerBusyError:** Service isn't able to process the request at this time. Client can wait for a period of time, then retry the operation.
113
-
114
-
-**MessagingEntityNotFoundError:** Entity associated with the operation doesn't exist or it has been deleted. Please make sure the entity exists.
115
-
116
-
-**MessagingEntityDisabledError:** Request for a runtime operation on a disabled entity. Please activate the entity.
103
+
-**ServiceBusQuotaExceededError:** Entity has reached maximum size or connection limit. Create space by receiving messages.
104
+
-**ServiceBusServerBusyError:** Service is temporarily overloaded. Implement exponential backoff retry.
105
+
-**MessagingEntityNotFoundError:** Entity does not exist or has been deleted.
106
+
-**MessagingEntityDisabledError:** Entity is disabled. Enable the entity to perform operations.
117
107
118
108
#### Auto Lock Renewal Exceptions
119
109
120
-
-**AutoLockRenewFailed:** An attempt to renew a lock on a message or session in the background has failed. This could happen when the receiver used by `AutoLockRenewer` is closed or the lock of the renewable has expired. It is recommended to re-register the renewable message or session by receiving the message or connect to the sessionful entity again.
121
-
122
-
-**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.
123
-
124
-
#### Python-Specific Considerations
125
-
126
-
-**ImportError/ModuleNotFoundError:** Common when Azure Service Bus dependencies are not properly installed. Ensure you have installed the correct package version:
127
-
```bash
128
-
pip install azure-servicebus
129
-
```
130
-
131
-
-**TypeError:** Often occurs when passing incorrect data types to Service Bus methods:
132
-
```python
133
-
# Incorrect: passing string instead of ServiceBusMessage
134
-
sender.send_messages("Hello World") # This will fail
135
-
136
-
# Correct: create ServiceBusMessage objects
137
-
from azure.servicebus import ServiceBusMessage
138
-
message = ServiceBusMessage("Hello World")
139
-
sender.send_messages(message)
140
-
```
141
-
142
-
-**ConnectionError/socket.gaierror:** Network-level errors that may require checking DNS resolution and network connectivity:
-**AutoLockRenewFailed:** Lock renewal failed. Re-register the renewable message or session.
111
+
-**AutoLockRenewTimeout:** Lock renewal timeout exceeded. Extend timeout or re-register the object.
151
112
152
113
### Timeouts
153
114
@@ -425,140 +386,53 @@ with receiver:
425
386
426
387
### Number of messages returned doesn't match number requested
427
388
428
-
When attempting to receive multiple messages using `receive_messages()` with `max_message_count` greater than 1, you're not guaranteed to receive the exact number requested.
429
-
430
-
**Why this happens:**
431
-
- Service Bus optimizes for throughput and latency
432
-
- After the first message is received, the receiver waits only a short time (typically 20ms) for additional messages
433
-
- The `max_wait_time` controls how long to wait for the **first** message, not subsequent ones
434
-
435
-
**Resolution:**
436
-
1.**Don't assume all available messages will be received in one call:**
437
-
```python
438
-
import time
439
-
from azure.servicebus.exceptions import MessagingEntityNotFoundError, MessagingEntityDisabledError
@@ -731,5 +605,3 @@ When filing GitHub issues for Service Bus, please include:
731
605
5.**Error details:** Complete exception stack trace and error messages
732
606
733
607
The more information provided, the faster we can help resolve your issue.
734
-
735
-
Please view the [exceptions reference docs](https://docs.microsoft.com/python/api/azure-servicebus/azure.servicebus.exceptions) for detailed descriptions of our common Exception types.
0 commit comments