-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ServiceBus] Send message didn't recovered after network disconnect. #15473
Comments
hey @cropse , thanks for reaching out. I tried to reproduce the issue locally but failed. I could get the error raised out.
Could you tell me which platform you're on and how you disconnect the network? ---------My reproduce error log---------- In azure-servicebus 7.0.0b8, disconnecting the network would give me
As you may know, we have just released azures-servicebus 7.0.0 GA version in which we improved our error design by switching to an condition based approach. I also tried to reproduce the issue in 7.0.0 which now would give me
|
I'm using Mac as test operating system, so probably is the specific issue only on macOS. here is entire code: #!/usr/bin/env python
import time
from azure.servicebus import ServiceBusClient, ServiceBusMessage
CONNECTION_STR = ""
TOPIC_NAME = ''
SUBSCRIPTION_NAME = ''
SESSION_ID = ''
def send_batch_message(sender):
batch_message = sender.create_message_batch()
print('disconnect network here')
time.sleep(15)
for _ in range(10):
try:
batch_message.add_message(ServiceBusMessage("Session Message inside a ServiceBusMessageBatch", session_id=SESSION_ID))
except ValueError:
# ServiceBusMessageBatch object reaches max_size.
# New ServiceBusMessageBatch object can be created here to send more data.
break
print('start to send message, reconnect your network!!')
sender.send_messages(batch_message)
print('success !!')
servicebus_client = ServiceBusClient.from_connection_string(conn_str=CONNECTION_STR, logging_enable=False, retry_total=10)
with servicebus_client:
receiver = servicebus_client.get_subscription_receiver(
topic_name=TOPIC_NAME,
subscription_name=SUBSCRIPTION_NAME
)
sender = servicebus_client.get_topic_sender(TOPIC_NAME)
with sender:
send_batch_message(sender)
print("Receive is done.") |
thanks for the code @cropse, I'll try it on my mac |
hey @cropse , confirming the issue on macOS. However, the issue seems to be within the deeper C layer (azure-c-shared-utility) which is not able to detect the network is down on macOS. If you want the code to work first, you could probably do some local check to mitigate: from azure.servicebus.exception import OperationTimeoutError
with sender:
try:
while tried_time <= 3:
sender.send_messages(message, timeout=10)
else:
# all retry failed, shutdown the sender, create a new sender and start the send flow again
except OperationTimeoutError:
tried_time += 1 |
hey @cropse, we have enhanced the underlying C library to be able to detect error IO status on MacOS. uamqp v1.2.13 is released today to include the fix. I'm closing the issue now, feel free to reopen if you still get trouble with the latest version. |
Describe the bug
sending message was infinitely blocked when network interrupted
To Reproduce
Steps to reproduce the behavior:
with the function from example like this
sender.send_messages
Expected behavior
should have mechanism to retry or raise exception at least
The text was updated successfully, but these errors were encountered: