0

I'm working with Azure ServiceBus, standard tier.

I'm trying to figure out what's happened since a couple of weeks, (it seems it started when bus traffic has increased, maybe 10-15 messages per second).

I have automatic creation of subscription using

subscriptionOpts.AutoDeleteOnIdle = TimeSpan.FromHours(3);

Starting from lasts weeks, (when we got a traffic increment), sometimes our subscriptionclients stopped receiving messages and after 3 hours they get deleted.

var messageOptions = new MessageHandlerOptions(args =>
    {
         Emaillog.Warn(args.Exception, $"Client ExceptionReceived: {args.Exception}");
         return Task.CompletedTask;
    }) { AutoComplete = true };
_subscriptionClient.RegisterMessageHandler(async (message, token) => await OnMessageReceived(message, $"{_subscriptionClient.SubscriptionName}", token), messageOptions);

Is it possible that a subscription client gets disconnected and doesn't connect anymore? I have 4-5 clients processes that connect to this topic, each one with his own subscription. When I find one of these subscriptions deleted, sometimes they have all been deleted, sometimes only some of them have been deleted.

Is it a bug? The only method call I do on the subscriptionClient is RegisterMessageHandler. I don't manage manually anything else...

Thank you in advance

nemenos
  • 877
  • 1
  • 10
  • 23
  • If there's no sending/receiving clients there will be no changes in messages on the broker. The broker will consider that entity idle and eventually remove that entity. @nemenos could you confirm that while apps are running there is or there's no change in message counts? – Sean Feldman Aug 03 '18 at 16:12
  • now I raised from 3 hours to 3 days, so I can debug it better and check. until now I could only find it after 3 hours, with subscription already deleted. But I'm sure that many messages were sent to the topic in the meanwhile (we have gps system connected sending positions) – nemenos Aug 03 '18 at 16:33
  • Ok, connection lost, and message still growing. No more messages received. a bug of dotnet library? ... – nemenos Aug 03 '18 at 20:26
  • As long as messages are sent in, the entity will be considered active. – Sean Feldman Aug 04 '18 at 04:50
  • not for subscriptions, messages are sent to topics... Now I know for sure that subscription.AutoDeleteOnIdle works good. It's my client that disconnects and does not reconnects, so after disconnection it gets automaatically deleted – nemenos Aug 04 '18 at 08:32
  • 1
    "messages sent in" sent to queue or topic. From topic they are getting into subs . Would be a too significant bug not to work. Cheers. – Sean Feldman Aug 04 '18 at 15:04
  • Yes, I get what you mean... But I haven't found anything on the documentation about possibility of disconnections of the client and eventual need (and ways) to reconnect, because actually that's what's happening – nemenos Aug 05 '18 at 09:20
  • We can already reproduce (a bug?) that if you change a setting on a Subscription, all Active clients are disconnected and do not connect again. This seems similar. I think that I'll create an issue on github – nemenos Aug 05 '18 at 09:27
  • Have you tried both of the clients and got the same result? I don't know if this should be counted towards a bug or not, as you're modifying entities... Just like when you send a message to an entity and modify it at the same time, entity will be marked as unavailable and message will not reach the destination. To get a definitive answer, you can raise an issue with the team. – Sean Feldman Aug 05 '18 at 14:12
  • https://github.com/Azure/azure-service-bus-dotnet/issues/549 Issue created – nemenos Aug 08 '18 at 14:51

1 Answers1

1

The property AutoDeleteOnIdle is used to delete the Subscription when there is no message processing with in the Subscription for the specified time span.

As you mentioned that the message flow increased to 15 messages per second, there is no chance that the Subscription is left empty (with out message flow). So there is no reason for the Subscriptions to delete. The idleness of the Subscription is decided by both incoming and outgoing messages.

There can be chances that due to heavy message traffic, the downstream application processing the messages may went offline, leaving the messages unprocessed, eventually when the message flow reduced there is no receiver to process the messages, leaving the Subscription idle for 3 hours and delete.

Arunprabhu
  • 1,454
  • 9
  • 15
  • The application did stay alive, that is the bus instance that is only used for broadcast. If the application went down we would know in 5 minutes (not 3 hours :) ) We also use another topic, with its own subscription (on the same process) that continues working. – nemenos Aug 03 '18 at 09:59
  • Then possibly it may be a bug. I have tried using AutoDeleteOnIdle, it worked for me but it is just a POC not in production environment. – Arunprabhu Aug 03 '18 at 10:25
  • it's weird, because it works for all our customers, except one and only when traffic increased – nemenos Aug 03 '18 at 12:15
  • 1
    The message receiver doesn't have anything to do with the traffic. The messages will be received sequentially by the receiver despite of the number of messages. – Arunprabhu Aug 03 '18 at 12:28