A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/Azure/azure-functions-eventhubs-extension/issues/81 below:

Event Hubs Functions stop triggering as the lease can't be renewed on an Storage Account v2 with Azure Data Lake Storage Gen 2 enabled.e Storage · Issue #81 · Azure/azure-functions-eventhubs-extension · GitHub

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} .

https://docs.microsoft.com/en-us/azure/storage/blobs/data-lake-storage-supported-blob-storage-features

Issue Mitigation

There are currently two mitigations that will work longer term.

  1. The first approach is to have a Timer Trigger that checks if it can acquire the lease and then breaks it. This will ensure that the messages keep triggering the Function.
    It does not prevent the leases from being lost though. Sample code is attached.
  2. The customer can move to a Storage v2 account that does not have Data Lake Storage Gen 2 enabled. This is only configurable on creation of the storage account.

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