Issue Summary
Customers using the Azure Functions Event Hub Trigger may see that the Event Hub fails to trigger.
This happens when the Function App has AzureWebJobsStorage set to use a Storage v2 Account and Data Lake Storage Gen2 Hierarchical Namespace Enabled.
Issue Details
In addition if you check the Storage account you may notice that the leases have expired on the containers for the Consumer Group and Partition Id.
Or in Storage Explorer
The Azure Functions Event Hub Trigger uses the Event Processor Host library version 3.0.0. which uses v9 of the Storage SDK.
I think it might be related to the hierarchical namespace support that gets added from ADLS Gen 2. The leases are taken out on {EventHubNamespace}/{EventHubName}/{ConsumerGroupName}/{PartitionNumber} .
Issue Mitigation
There are currently two mitigations that will work longer term.
Sample Code
This code may need modifications as this is dependent on the number of partitions that the Event Hub supports.
`
using System;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using Azure.Storage.Blobs;
using Microsoft.Azure.EventHubs;
using Microsoft.Azure.WebJobs;
using Microsoft.Extensions.Logging;
using Azure.Storage.Blobs.Specialized;
using Azure.Storage.Blobs.Models;
using Azure;
namespace TestLeaseRenewal
{
public static class ExpiredLeaseFixer
{
[FunctionName("ExpiredLeaseFixer")]
public static async Task Run(
[TimerTrigger("0 */5 * * * * ")] TimerInfo myTimer,
ILogger log)
{
string connectionString = "{useStorageAccountConnStrHere";
string containerName = "azure-webjobs-eventhub";
string[] blobNames = {
"/{eventHubNameSpace}.servicebus.windows.net/{EventHubName}/{ConsumerGroupName}/0",
"/{eventHubNameSpace}.servicebus.windows.net/{EventHubName}/{ConsumerGroupName}/1",
"/{eventHubNameSpace}.servicebus.windows.net/{EventHubName}/{ConsumerGroupName}/2",
"/{eventHubNameSpace}.servicebus.windows.net/{EventHubName}/{ConsumerGroupName}/3",
"/{eventHubNameSpace}.servicebus.windows.net/{EventHubName}/{ConsumerGroupName}/4",
};
BlobServiceClient blobServiceClient = new BlobServiceClient(connectionString);
BlobContainerClient containerClient = blobServiceClient.GetBlobContainerClient(containerName);
foreach (string blobName in blobNames)
{
BlobClient blobClient = containerClient.GetBlobClient(blobName);
BlobLeaseClient blobLeaseClient = new BlobLeaseClient(blobClient);
try
{
BlobLease blobLease = await blobLeaseClient.AcquireAsync(TimeSpan.FromSeconds(15));
blobLease = blobLeaseClient.Break();
log.LogInformation("Lease for blob broken:" + blobName);
}
catch (Exception e)
{
log.LogInformation("Failed to break blob lease for:" + blobName);
}
}
}
}
}
`
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4