2017-06-06 5 views
0

Ich erhalte OperationCanceledException, wenn ich eine Nachricht an eine Themenwarteschlange sende (ich verwende meinen Code innerhalb einer Azure-Funktion). Die Version, die ich verwende, ist: "WindowsAzure.ServiceBus": "4.1.1" (neuste) und ich bekomme diese Ausnahme, wenn ich Belastungstests mache, was bedeutet, dass viele Nachrichten in diesem Servicebus gesendet werden (der mehrere enthält) Themen). Mir wurde gesagt, einen Wiederholungsmechanismus zu verwenden:OperationCanceledException beim Senden an den Servicebus

client.RetryPolicy = new RetryExponential(minBackoff: TimeSpan.FromSeconds(0.1), 
              maxBackoff: TimeSpan.FromSeconds(30), 
              maxRetryCount: 3); 

Aber ich dachte, das standardmäßig bereits geschehen ist, nicht wahr?

Wäre Ihre Hilfe hier angemessen - Warum bekomme ich diese Ausnahme und was kann ich tun, um dies zu beheben? Hier

ist die Ausnahme:

Exception System.OperationCanceledException: The operation cannot be performed because the entity has been closed or aborted. ---> System.ServiceModel.CommunicationObjectAbortedException: Internal Server Error: The server did not provide a meaningful reply; this might be caused by a premature session shutdown. TrackingId:88386cb1-a4e6-42e2-a8e1-bad3a2403329, Timestamp:6/6/2017 7:55:23 AM 
    at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result) 
    at Microsoft.ServiceBus.Messaging.Sbmp.DuplexRequestBindingElement.DuplexRequestSessionChannel.EndRequest(IAsyncResult result) 
    at Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement.ReconnectChannelFactory`1.RequestSessionChannel.RequestAsyncResult.<>c.<GetAsyncSteps>b__9_3(RequestAsyncResult thisPtr, IAsyncResult r) 
    at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.StepCallback(IAsyncResult result) 
--- End of stack trace from previous location where exception was thrown --- 
    at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result) 
    at Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement.ReconnectChannelFactory`1.RequestSessionChannel.EndRequest(IAsyncResult result) 
    at Microsoft.ServiceBus.Messaging.Sbmp.RedirectBindingElement.RedirectContainerChannelFactory`1.RedirectContainerSessionChannel.RequestAsyncResult.<>c__DisplayClass8_1.<GetAsyncSteps>b__4(RequestAsyncResult thisPtr, IAsyncResult r) 
    at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.StepCallback(IAsyncResult result) 
--- End of stack trace from previous location where exception was thrown --- 
    at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result) 
    at Microsoft.ServiceBus.Messaging.Sbmp.RedirectBindingElement.RedirectContainerChannelFactory`1.RedirectContainerSessionChannel.EndRequest(IAsyncResult result) 
    at Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement.ReconnectChannelFactory`1.RequestSessionChannel.RequestAsyncResult.<>c.<GetAsyncSteps>b__9_3(RequestAsyncResult thisPtr, IAsyncResult r) 
    at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.StepCallback(IAsyncResult result) 
--- End of stack trace from previous location where exception was thrown --- 
    at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result) 
    at Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement.ReconnectChannelFactory`1.RequestSessionChannel.EndRequest(IAsyncResult result) 
    at Microsoft.ServiceBus.Messaging.Sbmp.SbmpTransactionalAsyncResult`1.<>c.<GetAsyncSteps>b__18_3(TIteratorAsyncResult thisPtr, IAsyncResult a) 
    at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.StepCallback(IAsyncResult result) 
--- End of stack trace from previous location where exception was thrown --- 
    at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result) 
    at Microsoft.ServiceBus.Messaging.Sbmp.SbmpMessageSender.EndSendCommand(IAsyncResult result) 
    --- End of inner exception stack trace --- 
    at Microsoft.ServiceBus.Messaging.Sbmp.SbmpMessageSender.EndSendCommand(IAsyncResult result) 
    at Microsoft.ServiceBus.Messaging.Sbmp.SbmpMessageSender.OnEndSend(IAsyncResult result) 
    at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.StepCallback(IAsyncResult result) 
--- End of stack trace from previous location where exception was thrown --- 
    at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result) 
    at Microsoft.ServiceBus.Messaging.MessageSender.OnSend(TrackingContext trackingContext, IEnumerable`1 messages, TimeSpan timeout) 
    at Microsoft.ServiceBus.Messaging.MessageSender.Send(TrackingContext trackingContext, IEnumerable`1 messages, TimeSpan timeout) 

Antwort

1

Retry Politik wird von der ASB-Client standardmäßig aktiviert. Sie müssen es nicht selbst tun.

Exception Sie erhalten, ist OperationCanceledException und nach Dokumentation:

Retry will not help.

, die als "User Codierungsfehler" kategorisiert. Mit Blick auf die Ausnahme-Stack-Trace, geschieht dies während des Betriebs senden, und der Fehler ist

Internal Server Error: The server did not provide a meaningful reply; this might be caused by a premature session shutdown. TrackingId:88386cb1-a4e6-42e2-a8e1-bad3a2403329...

Ich bin mir ziemlich sicher, dass dieser Code Fehler nicht vom Benutzer ist, sondern etwas, das Platz auf der Broker Seite nahm. Das TrackingId, das mit dem Fehler bereitgestellt wird, sollte es Ihnen ermöglichen, einen Supportfall mit Microsoft zu öffnen, um zumindest eine Idee zu haben, was bei dem Broker fehlschlug, wenn dieser Befehl fehlschlug.

bearbeiten

Inzwischen, was ich würde es vorschlägt Ihren Betrieb mit einer zusätzlichen Wiederholungs/Backoff-Logik zu implementieren. Etwas, das sich nicht in einer engen Schleife wiederholen würde und nicht von der RetryPolicy des Kunden abhängen würde.

Verwandte Themen