Azure Service Bus: AMQP object is closing. Operation 'attach' cannot be performed










3















I'm using Azure Service Bus Topics with the AMQP protocol in the West Europe datacenter.
This is a schematic way of how the solution implented works:



private Microsoft.Azure.ServiceBus.SubscriptionClient CreateClient() 
string serviceBusConnectionString;
strin serviceBusTopicName;
string subscriptionName;

var subscriptionClient = new Microsoft.Azure.ServiceBus.SubscriptionClient(serviceBusConnectionString, serviceBusTopicName, subscriptionName)
PrefetchCount = 0
;
return subscriptionClient;


public async Task<ISubscriptionClient> CreateSubscriptionClientAsync()
//Some logic on the subscriptionClient, caching, creating a new one if it doesn't exists, etc.
return CreateClient()


private async Task CallbackAsync(Message msg, CancellationToken cancellationToken)
//Do stuff with the Message
//when you're done Completethe message


public async Task<string> OpenAsync(CancellationToken cancellationToken)
subscriptionClient = await CreateSubscriptionClientAsync().ConfigureAwait(false);
var messageHandlerOptions = new MessageHandlerOptions(ExceptionReceivedHandlerAsync)
AutoComplete = false,
MaxAutoRenewDuration = TimeSpan.FromHours(8)
;
subscriptionClient.RegisterMessageHandler(CallbackAsync, messageHandlerOptions);
return string.Empty;



But last night I had couple of thousand exception like this one:



Exception: "System.InvalidOperationException: The AMQP object g2b-sessionXXXXXXXX is closing. Operation 'attach' cannot be performed.
at Microsoft.Azure.ServiceBus.Core.MessageReceiver.<OnReceiveAsync>d__86.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.ServiceBus.Core.MessageReceiver.<>c__DisplayClass64_0.<<ReceiveAsync>b__0>d.MoveNext()


I'm using the Microsoft.Azure.ServiceBus v3.1.0.0,
On line I didn't find anything useful about this "Operation 'attach' cannot be performed".



On the message bus exception list page I didn't find any information about this specific problem. And in the status history site there is no reference about any outage involving Service Bus.



Did anyone experience this problem before?

What is causing the exception?

Do I need to implement any retry logic? How?

Any help is apreciated, thanks.










share|improve this question


























    3















    I'm using Azure Service Bus Topics with the AMQP protocol in the West Europe datacenter.
    This is a schematic way of how the solution implented works:



    private Microsoft.Azure.ServiceBus.SubscriptionClient CreateClient() 
    string serviceBusConnectionString;
    strin serviceBusTopicName;
    string subscriptionName;

    var subscriptionClient = new Microsoft.Azure.ServiceBus.SubscriptionClient(serviceBusConnectionString, serviceBusTopicName, subscriptionName)
    PrefetchCount = 0
    ;
    return subscriptionClient;


    public async Task<ISubscriptionClient> CreateSubscriptionClientAsync()
    //Some logic on the subscriptionClient, caching, creating a new one if it doesn't exists, etc.
    return CreateClient()


    private async Task CallbackAsync(Message msg, CancellationToken cancellationToken)
    //Do stuff with the Message
    //when you're done Completethe message


    public async Task<string> OpenAsync(CancellationToken cancellationToken)
    subscriptionClient = await CreateSubscriptionClientAsync().ConfigureAwait(false);
    var messageHandlerOptions = new MessageHandlerOptions(ExceptionReceivedHandlerAsync)
    AutoComplete = false,
    MaxAutoRenewDuration = TimeSpan.FromHours(8)
    ;
    subscriptionClient.RegisterMessageHandler(CallbackAsync, messageHandlerOptions);
    return string.Empty;



    But last night I had couple of thousand exception like this one:



    Exception: "System.InvalidOperationException: The AMQP object g2b-sessionXXXXXXXX is closing. Operation 'attach' cannot be performed.
    at Microsoft.Azure.ServiceBus.Core.MessageReceiver.<OnReceiveAsync>d__86.MoveNext()
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
    at Microsoft.Azure.ServiceBus.Core.MessageReceiver.<>c__DisplayClass64_0.<<ReceiveAsync>b__0>d.MoveNext()


    I'm using the Microsoft.Azure.ServiceBus v3.1.0.0,
    On line I didn't find anything useful about this "Operation 'attach' cannot be performed".



    On the message bus exception list page I didn't find any information about this specific problem. And in the status history site there is no reference about any outage involving Service Bus.



    Did anyone experience this problem before?

    What is causing the exception?

    Do I need to implement any retry logic? How?

    Any help is apreciated, thanks.










    share|improve this question
























      3












      3








      3








      I'm using Azure Service Bus Topics with the AMQP protocol in the West Europe datacenter.
      This is a schematic way of how the solution implented works:



      private Microsoft.Azure.ServiceBus.SubscriptionClient CreateClient() 
      string serviceBusConnectionString;
      strin serviceBusTopicName;
      string subscriptionName;

      var subscriptionClient = new Microsoft.Azure.ServiceBus.SubscriptionClient(serviceBusConnectionString, serviceBusTopicName, subscriptionName)
      PrefetchCount = 0
      ;
      return subscriptionClient;


      public async Task<ISubscriptionClient> CreateSubscriptionClientAsync()
      //Some logic on the subscriptionClient, caching, creating a new one if it doesn't exists, etc.
      return CreateClient()


      private async Task CallbackAsync(Message msg, CancellationToken cancellationToken)
      //Do stuff with the Message
      //when you're done Completethe message


      public async Task<string> OpenAsync(CancellationToken cancellationToken)
      subscriptionClient = await CreateSubscriptionClientAsync().ConfigureAwait(false);
      var messageHandlerOptions = new MessageHandlerOptions(ExceptionReceivedHandlerAsync)
      AutoComplete = false,
      MaxAutoRenewDuration = TimeSpan.FromHours(8)
      ;
      subscriptionClient.RegisterMessageHandler(CallbackAsync, messageHandlerOptions);
      return string.Empty;



      But last night I had couple of thousand exception like this one:



      Exception: "System.InvalidOperationException: The AMQP object g2b-sessionXXXXXXXX is closing. Operation 'attach' cannot be performed.
      at Microsoft.Azure.ServiceBus.Core.MessageReceiver.<OnReceiveAsync>d__86.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.Azure.ServiceBus.Core.MessageReceiver.<>c__DisplayClass64_0.<<ReceiveAsync>b__0>d.MoveNext()


      I'm using the Microsoft.Azure.ServiceBus v3.1.0.0,
      On line I didn't find anything useful about this "Operation 'attach' cannot be performed".



      On the message bus exception list page I didn't find any information about this specific problem. And in the status history site there is no reference about any outage involving Service Bus.



      Did anyone experience this problem before?

      What is causing the exception?

      Do I need to implement any retry logic? How?

      Any help is apreciated, thanks.










      share|improve this question














      I'm using Azure Service Bus Topics with the AMQP protocol in the West Europe datacenter.
      This is a schematic way of how the solution implented works:



      private Microsoft.Azure.ServiceBus.SubscriptionClient CreateClient() 
      string serviceBusConnectionString;
      strin serviceBusTopicName;
      string subscriptionName;

      var subscriptionClient = new Microsoft.Azure.ServiceBus.SubscriptionClient(serviceBusConnectionString, serviceBusTopicName, subscriptionName)
      PrefetchCount = 0
      ;
      return subscriptionClient;


      public async Task<ISubscriptionClient> CreateSubscriptionClientAsync()
      //Some logic on the subscriptionClient, caching, creating a new one if it doesn't exists, etc.
      return CreateClient()


      private async Task CallbackAsync(Message msg, CancellationToken cancellationToken)
      //Do stuff with the Message
      //when you're done Completethe message


      public async Task<string> OpenAsync(CancellationToken cancellationToken)
      subscriptionClient = await CreateSubscriptionClientAsync().ConfigureAwait(false);
      var messageHandlerOptions = new MessageHandlerOptions(ExceptionReceivedHandlerAsync)
      AutoComplete = false,
      MaxAutoRenewDuration = TimeSpan.FromHours(8)
      ;
      subscriptionClient.RegisterMessageHandler(CallbackAsync, messageHandlerOptions);
      return string.Empty;



      But last night I had couple of thousand exception like this one:



      Exception: "System.InvalidOperationException: The AMQP object g2b-sessionXXXXXXXX is closing. Operation 'attach' cannot be performed.
      at Microsoft.Azure.ServiceBus.Core.MessageReceiver.<OnReceiveAsync>d__86.MoveNext()
      --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.Azure.ServiceBus.Core.MessageReceiver.<>c__DisplayClass64_0.<<ReceiveAsync>b__0>d.MoveNext()


      I'm using the Microsoft.Azure.ServiceBus v3.1.0.0,
      On line I didn't find anything useful about this "Operation 'attach' cannot be performed".



      On the message bus exception list page I didn't find any information about this specific problem. And in the status history site there is no reference about any outage involving Service Bus.



      Did anyone experience this problem before?

      What is causing the exception?

      Do I need to implement any retry logic? How?

      Any help is apreciated, thanks.







      c# azure azureservicebus






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 14 '18 at 15:51









      NarduNardu

      608




      608






















          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53304061%2fazure-service-bus-amqp-object-is-closing-operation-attach-cannot-be-performe%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53304061%2fazure-service-bus-amqp-object-is-closing-operation-attach-cannot-be-performe%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          What does pagestruct do in Eviews?

          Dutch intervention in Lombok and Karangasem

          Channel Islands