关于Microsoft.ServiceBus.Messaging.LeaseLostException [英] About Microsoft.ServiceBus.Messaging.LeaseLostException
问题描述
在我的EventHub处理器中,我遇到了Microsoft.ServiceBus.Messaging.LeaseLostException异常.
I got an exception of Microsoft.ServiceBus.Messaging.LeaseLostException, in my EventHub processor.
此异常是什么意思?此异常的可能根本原因是什么?
what does this exception mean? What is the possible root cause of this exception?
以下是堆栈跟踪:
\ r \ n--从上一个引发异常的位置开始的堆栈跟踪--- \ r \ n 在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)\ r \ n 在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\ r \ n 在Microsoft.ServiceBus.Messaging.BlobLeaseManager.d__25.MoveNext()\ r \ n--从上一个引发异常的位置开始的堆栈跟踪--- \ r \ n 在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)\ r \ n 在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\ r \ n
at Microsoft.ServiceBus.Messaging.BlobLeaseManager.d__24.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.ServiceBus.Messaging.BlobLeaseManager.d__25.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n
在MyEventHub.EventProcessor`1.d__6.MoveNext()\ r \ n \ r \ nMicrosoft.WindowsAzure.Storage.StorageException:\远程服务器返回错误:(409)冲突.\":
at MyEventHub.EventProcessor`1.d__6.MoveNext()\r\n\r\nMicrosoft.WindowsAzure.Storage.StorageException : \"The remote server returned an error: (409) Conflict.\":
在c:\ Program Files(x86)\ Jenkins \ workspace \ release_dotnet_master \ Lib \ ClassLibraryCommon \ Core \ Executor \ Executor中的Microsoft.WindowsAzure.Storage.Core.Executor.Executor.EndExecuteAsync [T](IAsyncResult结果)中. cs:第60行\ r \ n
在Microsoft.WindowsAzure.Storage.Core.Util.AsyncExtensions.<> c__DisplayClass4.b__3(IAsyncResult ar)中的c:\ Program Files(x86)\ Jenkins \ workspace \ release_dotnet_master \ Lib \ ClassLibraryCommon \ Core \ Util \ AsyncExtensions.cs :line 115 \ r \ n ---从上一个引发异常的位置开始的堆栈跟踪--- \ r \ n
在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)\ r \ n
在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)\ r \ n
在Microsoft.ServiceBus.Messaging.BlobLeaseManager.d__24.MoveNext()\ r \ n \ r \ nSystem.Net.WebException:\远程服务器返回错误:(409)冲突.\":
在Microsoft.WindowsAzure.Storage.Shared.Protocol.HttpResponseParsers.ProcessExpectedStatusCodeNoException [T](HttpStatusCode ExpectedStatusCode,HttpStatusCode actualStatusCode,T retVal,StorageCommandBase 1 cmd, Exception ex) in c:\\Program Files (x86)\\Jenkins\\workspace\\release_dotnet_master\\Lib\\Common\\Shared\\Protocol\\HttpResponseParsers.Common.cs:line 50\r\n
at Microsoft.WindowsAzure.Storage.Blob.CloudBlob.<>c__DisplayClass33.<RenewLeaseImpl>b__32(RESTCommand
1 cmd,HttpWebResponse resp,Exception ex,OperationContext ctx)(在c:\ Program中x86)\ Jenkins \ workspace \ release_dotnet_master \ Lib \ ClassLibraryCommon \ Blob \ CloudBlob.cs:line 3186 \ r \ n
在Microsoft.WindowsAzure.Storage.Core.Executor.Executor.EndGetResponse [T](IAsyncResult getResponseResult)中的c:\ Program Files(x86)\ Jenkins \ workspace \ release_dotnet_master \ Lib \ ClassLibraryCommon \ Core \ Executor \ Executor.cs:line 306"
at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.EndExecuteAsync[T](IAsyncResult result) in c:\Program Files (x86)\Jenkins\workspace\release_dotnet_master\Lib\ClassLibraryCommon\Core\Executor\Executor.cs:line 60\r\n
at Microsoft.WindowsAzure.Storage.Core.Util.AsyncExtensions.<>c__DisplayClass4.b__3(IAsyncResult ar) in c:\Program Files (x86)\Jenkins\workspace\release_dotnet_master\Lib\ClassLibraryCommon\Core\Util\AsyncExtensions.cs:line 115\r\n--- End of stack trace from previous location where exception was thrown ---\r\n
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n
at Microsoft.ServiceBus.Messaging.BlobLeaseManager.d__24.MoveNext()\r\n\r\nSystem.Net.WebException : \"The remote server returned an error: (409) Conflict.\":
at Microsoft.WindowsAzure.Storage.Shared.Protocol.HttpResponseParsers.ProcessExpectedStatusCodeNoException[T](HttpStatusCode expectedStatusCode, HttpStatusCode actualStatusCode, T retVal, StorageCommandBase1 cmd, Exception ex) in c:\\Program Files (x86)\\Jenkins\\workspace\\release_dotnet_master\\Lib\\Common\\Shared\\Protocol\\HttpResponseParsers.Common.cs:line 50\r\n
at Microsoft.WindowsAzure.Storage.Blob.CloudBlob.<>c__DisplayClass33.<RenewLeaseImpl>b__32(RESTCommand
1 cmd, HttpWebResponse resp, Exception ex, OperationContext ctx) in c:\Program Files (x86)\Jenkins\workspace\release_dotnet_master\Lib\ClassLibraryCommon\Blob\CloudBlob.cs:line 3186\r\n
at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.EndGetResponse[T](IAsyncResult getResponseResult) in c:\Program Files (x86)\Jenkins\workspace\release_dotnet_master\Lib\ClassLibraryCommon\Core\Executor\Executor.cs:line 306"
在我自己的代码中,唯一的内部异常是:
And the only internal exception in my own code is:
位于MyEventHub.EventProcessor`1. CloseAsync >> d__6.MoveNext()\ r \ n \ r \ nMicrosoft.WindowsAzure.Storage.StorageException:\远程服务器返回错误:(409)冲突.\": ...
这是CloseAsync的代码:
And here is the code of CloseAsync:
public async Task CloseAsync(PartitionContext context, CloseReason reason)
{
try
{
if (reason == CloseReason.Shutdown)
{
await context.CheckpointAsync();
}
}
catch (Exception ex)
{
this.HandleException(ex);
}
finally
{
this.configuration.DecrementOpenedPartitionCount?.Invoke();
}
}
MyEventHub以工作角色托管,该角色在Azure中部署了 2个实例.
MyEventHub is hosted in worker role which deployed 2 instance in Azure.
推荐答案
@Youxu,为您的EventHub
配置了多少个接收器(EventProcessorHost
)?据我所知,我们只能有一个具有某些时代.如果我们创建一个EventHub
侦听器(具有默认选项),而一个侦听器已经列出到一个EventHub
中,则由于
@Youxu , for your EventHub
, how many receivers ( EventProcessorHost
) are configured?. As per my knowledge we can have only one active receiver with certain epoch. If we create a EventHub
listener ( with default options) while one listener is already listing to a EventHub
, newly created listener gets higher epoch and first listener gets disconnected due to LeaseLostException
检查(偶然地)为同一EventHub
同时运行多个接收器.
Check if you are (accidentally) running more than one receiver for same EventHub
concurrently.
这篇关于关于Microsoft.ServiceBus.Messaging.LeaseLostException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!