2017-01-09 6 views
0

Webjob拡張SDKを使用しているWebジョブと、手動で起動され、サービスバスに読み書きする機能があります。Azure Webjob SDKを使用しているときにTopicClientがハングします

メッセージを送信するとハングするようです。私は次のエラーを取得しています

JobHostConfiguration config = new JobHostConfiguration 
      { 
       StorageConnectionString = decryptedStorageConnectionString, 
       DashboardConnectionString = decryptedDashboardConnectionString, 
      }; 
      config.UseTimers(); 
      var host = new JobHost(config); 

      host.CallAsync(typeof(Program).GetMethod(nameof(myJob))); 

      // The following code ensures that the WebJob will be running continuously 
      host.RunAndBlock(); 

[NoAutomaticTrigger] 
     public void myJob(TextWriter log) 
     { 
... 
this.Client = TopicClient.CreateFromConnectionString(connection, ConstantStrings.IncidentResponseTopicName); 
this.Client.Send(args); 

} 

::私は定期的にAzureのwebjobを使用する場合

The request operation did not complete within the allotted timeout of 00:01:09.7322175. The time allotted to this operation may have been a portion of a longer timeout. For more information on exception types and proper exception handling, please refer to http://go.microsoft.com/fwlink/?LinkId=761101 TrackingId:fdbd3e20-c1b7-4829-8ebd-b9b14962c13f, Timestamp:1/9/2017 10:14:07 AM 

System.TimeoutException: The request operation did not complete within the allotted timeout of 00:01:09.9496489. The time allotted to this operation may have been a portion of a longer timeout. For more information on exception types and proper exception handling, please refer to http://go.microsoft.com/fwlink/?LinkId=761101 TrackingId:570d2e9f-cd9f-4bb5-8d52-45ecf026df3f, Timestamp:1/9/2017 10:15:18 AM 
[01/09/2017 10:15:18 > ff1c90: INFO] 
[01/09/2017 10:15:18 > ff1c90: INFO] Server stack trace: 
[01/09/2017 10:15:18 > ff1c90: INFO] 
[01/09/2017 10:15:18 > ff1c90: INFO] 
[01/09/2017 10:15:18 > ff1c90: INFO] Exception rethrown at [0]: 
[01/09/2017 10:15:18 > ff1c90: INFO] at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result) 
[01/09/2017 10:15:18 > ff1c90: INFO] at Microsoft.ServiceBus.Messaging.Sbmp.DuplexRequestBindingElement.DuplexRequestSessionChannel.EndRequest(IAsyncResult result) 
[01/09/2017 10:15:18 > ff1c90: INFO] at Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement.ReconnectChannelFactory`1.RequestSessionChannel.RequestAsyncResult.<>c.<GetAsyncSteps>b__9_3(RequestAsyncResult thisPtr, IAsyncResult r) 
[01/09/2017 10:15:18 > ff1c90: INFO] at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.StepCallback(IAsyncResult result) 
[01/09/2017 10:15:18 > ff1c90: INFO] 
[01/09/2017 10:15:18 > ff1c90: INFO] Exception rethrown at [1]: 
[01/09/2017 10:15:18 > ff1c90: INFO] at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result) 
[01/09/2017 10:15:18 > ff1c90: INFO] at Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement.ReconnectChannelFactory`1.RequestSessionChannel.EndRequest(IAsyncResult result) 
[01/09/2017 10:15:18 > ff1c90: INFO] at Microsoft.ServiceBus.Messaging.Sbmp.RedirectBindingElement.RedirectContainerChannelFactory`1.RedirectContainerSessionChannel.RequestAsyncResult.<>c__DisplayClass8_1.<GetAsyncSteps>b__4(RequestAsyncResult thisPtr, IAsyncResult r) 
[01/09/2017 10:15:18 > ff1c90: INFO] at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.StepCallback(IAsyncResult result) 
[01/09/2017 10:15:18 > ff1c90: INFO] 
[01/09/2017 10:15:18 > ff1c90: INFO] Exception rethrown at [2]: 
[01/09/2017 10:15:18 > ff1c90: INFO] at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result) 
[01/09/2017 10:15:18 > ff1c90: INFO] at Microsoft.ServiceBus.Messaging.Sbmp.RedirectBindingElement.RedirectContainerChannelFactory`1.RedirectContainerSessionChannel.EndRequest(IAsyncResult result) 
[01/09/2017 10:15:18 > ff1c90: INFO] at Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement.ReconnectChannelFactory`1.RequestSessionChannel.RequestAsyncResult.<>c.<GetAsyncSteps>b__9_3(RequestAsyncResult thisPtr, IAsyncResult r) 
[01/09/2017 10:15:18 > ff1c90: INFO] at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.StepCallback(IAsyncResult result) 
[01/09/2017 10:15:18 > ff1c90: INFO] 
[01/09/2017 10:15:18 > ff1c90: INFO] Exception rethrown at [3]: 
[01/09/2017 10:15:18 > ff1c90: INFO] at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result) 
[01/09/2017 10:15:18 > ff1c90: INFO] at Microsoft.ServiceBus.Messaging.Channels.ReconnectBindingElement.ReconnectChannelFactory`1.RequestSessionChannel.EndRequest(IAsyncResult result) 
[01/09/2017 10:15:18 > ff1c90: INFO] at Microsoft.ServiceBus.Messaging.Sbmp.SbmpTransactionalAsyncResult`1.<>c.<GetAsyncSteps>b__18_3(TIteratorAsyncResult thisPtr, IAsyncResult a) 
[01/09/2017 10:15:18 > ff1c90: INFO] at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.StepCallback(IAsyncResult result) 
[01/09/2017 10:15:18 > ff1c90: INFO] 
[01/09/2017 10:15:18 > ff1c90: INFO] Exception rethrown at [4]: 
[01/09/2017 10:15:18 > ff1c90: INFO] at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result) 
[01/09/2017 10:15:18 > ff1c90: INFO] at Microsoft.ServiceBus.Messaging.Sbmp.SbmpMessageReceiver.EndUpdateCommand(IAsyncResult result) 
[01/09/2017 10:15:18 > ff1c90: INFO] at Microsoft.ServiceBus.Messaging.Sbmp.SbmpMessageReceiver.OnEndComplete(IAsyncResult result) 
[01/09/2017 10:15:18 > ff1c90: INFO] at Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.StepCallback(IAsyncResult result) 
[01/09/2017 10:15:18 > ff1c90: INFO] 
[01/09/2017 10:15:18 > ff1c90: INFO] Exception rethrown at [5]: 
[01/09/2017 10:15:18 > ff1c90: INFO] at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result) 
[01/09/2017 10:15:18 > ff1c90: INFO] at Microsoft.ServiceBus.Messaging.MessageReceiver.OnComplete(TrackingContext trackingContext, IEnumerable`1 lockTokens, TimeSpan timeout) 
[01/09/2017 10:15:18 > ff1c90: INFO] at Microsoft.ServiceBus.Messaging.MessageReceiver.Complete(TrackingContext trackingContext, IEnumerable`1 lockTokens, TimeSpan timeout) 
[01/09/2017 10:15:18 > ff1c90: INFO] at Microsoft.ServiceBus.Messaging.ReceiveContext.Complete() 
[01/09/2017 10:15:18 > ff1c90: INFO] at MyJob.myJob.<ExecuteJob>b__4_0(BrokeredMessage request) 

すべてがうまく働いた

はここに関連するコードです。 Azure Webjob SDKにコードを移動したとき、このハンギングが始まりました。 もう1つ興味深いのは、ローカルマシンでこれを実行すると、すべてがうまくいくように見えることです。これはAzure Webjobsにコードをデプロイするときに発生します。

+0

なぜ 'host.CallAsync'を使用していますか?あなたの例では、メソッドは非同期ではありません。接続文字列についても確かですか? – Thomas

+0

はい、私はそれをローカルで実行すると永遠にうまく動作します。 –

+0

'host.Call'を使ってみることはできますか? – Thomas

答えて

0

あなたのコードによると、他のジョブをスケジュールし、JobHostの起動時に手動でmyJob関数を非同期に呼び出して、サービスバスとの間でメッセージを読み書きすることを想定していました。 Service BusのメッセージングTimeoutExceptionについて公式documentで述べたように

System.TimeoutException: The request operation did not complete within the allotted timeout of 00:01:09.9496489. The time allotted to this operation may have been a portion of a longer timeout.

A TimeoutException indicates that a user-initiated operation is taking longer than the operation timeout. You should check the value of the ServicePointManager.DefaultConnectionLimit property, as hitting this limit can also cause a TimeoutException.

The server did not respond to the requested operation within the specified time which is controlled by OperationTimeout .

私はあなたのTopicClientを構築するためにOperationTimeoutを高め、次のように再試行ロジックを追加しようとすることができると仮定:

var builder = new ServiceBusConnectionStringBuilder("{ServicesBusConnectionString}") 
{ 
    OperationTimeout = TimeSpan.FromMinutes(10) 
}; 
var messagingFactory = MessagingFactory.CreateFromConnectionString(builder.ToString()); 
TopicClient topicClient = messagingFactory.CreateTopicClient("{TopicName}"); 
topicClient.RetryPolicy = new RetryExponential(
      TimeSpan.Zero, 
      TimeSpan.FromMinutes(5), 
      2); 
topicClient.Send("{BrokeredMessage}"); 
+0

おかげでブルースが助けになりません。 webjob。 もう1つ興味深いのは、Azure SDK拡張機能を使用せずに関数を呼び出すと、展開されていてもすべてがうまく動作することです。これは、空白のwebjobのバグのように感じます –

関連する問題