Azure / azure-functions-eventhubs-extension

Event Hubs extension for Azure Functions
MIT License
20 stars 26 forks source link

Two different events on one trigger #122

Closed ashamrai closed 1 year ago

ashamrai commented 1 year ago

As inheritor of https://github.com/Azure/Azure-Functions/issues/2310

Runtime version: ~4 Os: windows Hosting plan: consumption Language: java Trigger: Event Hub

When we receive "Did not find any initialized language workers", we expect retrying of failed function.

Example:

image

This is traces of the failed execution: image

and we see the retries (line 2 and 3):

image

However, the first retry receives:

image

The second retry receives:

image

So... two executions with the same partition, offset, sequence number and enqueue time receive two different events.

Then I`ve tried to read this event through this simple code:

       var consumer = new EventHubConsumerClient(consumerGroup, connectionString, eventHubName);

        EventPosition eventPosition = EventPosition.FromSequenceNumber(9916);            

        await foreach (var ev in consumer.ReadEventsFromPartitionAsync("6", eventPosition))
        {

            ReadOnlyMemory<byte> eventBodyBytess = ev.Data.EventBody.ToMemory();

            var bodys = eventBodyBytess.ToArray();
            var messages = Encoding.UTF8.GetString(bodys);
            Console.WriteLine("{0}", messages);

            return;
        }

So... Why do two different executions (with the same trigger) return different result?

ramya894 commented 1 year ago

@ashamrai : Kindly share us the Function App details privately, so that we can check the backend logs for your Application. Sharing-Your-Function-App-name-privately

ashamrai commented 1 year ago

Location: West Europe Failed run: timestamp [UTC] = 2022-12-07T13:08:42.6715745Z ; Id=43fd7050-2e14-487b-9aaa-cdf81fe6450d First retry: timestamp [UTC] = 2022-12-07T13:09:12.9488119Z; Id=b7cf4e13-fca6-404a-bcd0-73b7b738aa5a Second retry: timestamp [UTC] = 2022-12-07T13:09:12.9499934Z; Id=57c2717f-f02a-4734-80ff-e46d3ec6f240

bhagyshricompany commented 1 year ago

@alrod please comment and validate on this.

bhagyshricompany commented 1 year ago

@ashamrai what is eventhub extension verson?

bhagyshricompany commented 1 year ago

pls update about eventhub version

ashamrai commented 1 year ago

@bhagyshricompany our configuration:

{
    "version": "2.0",
    "extensionBundle": {
        "id": "Microsoft.Azure.Functions.ExtensionBundle",
        "version": "[2.*, 3.0.0)"
    }
}
bhagyshricompany commented 1 year ago

@sidkri pls comment

bhagyshricompany commented 1 year ago

@ashamrai Ican see function is still runing in problematic version. please go through this link which is updated for fixed. https://github.com/Azure/azure-functions-eventhubs-extension/issues/114

sidkri commented 1 year ago

Thanks @bhagyshricompany for identifying the work around. @ashamrai please upgrade to extensions bundle v4 which uses the latest verison of the Event Hubs extension and SDK that does not have this logging issue: https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-register#extension-bundles Set the extensionBundle.version to "[4.0.0, 5.0.0)". Compile locally to ensure no code changes are needed.

Please close this issue once you have upgraded and no longer have the issue as we are tracking the logging issue via #144

ghost commented 1 year ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.