How to increase message execution timeout in python ServiceBusTrigger in Azure function

Singh, Satyam 1 Reputation point
2022-02-03T06:45:09.583+00:00

I am using python ServiceBusTrigger in Azure function and for every message received, it takes more than 5 minutes to process.
It seems default timeout for message execution in ServiceBusTrigger is 5 min, after that it is replaying message again for execution.

I want to increase timeout for execution time, such that message execution can run for longer time.

I have tried increasing functionTimeoutbelow setting in host.json, but still 5 min expiry is happening:
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[2.*, 3.0.0)"
},
"functionTimeout":"00:30:00"

function logs for replaying of messages after 5 minutes:

But still i could see messages are re-executed in function after 5 mins, if execution is not completed within 5 mins.

2022-02-04T13:44:45.340 [Information] Trigger Details: MessageId: 31b5bf9b-5441-44ba-a3c0-38e5a96b9d3c, SequenceNumber: 273, DeliveryCount: 1, EnqueuedTimeUtc: 2022-02-04T13:44:44.9930000Z, LockedUntilUtc: 9999-12-31T23:59:59.9999999Z, SessionId: fb952bb6-e7d3-4d32-a54d-15d4ea577f91
2022-02-04T13:44:45.651 [Information] Executing 'Functions.ServiceBusTriggerAnalytics' (Reason='(null)', Id=f9141e9b-149a-4bb9-9d50-90b880662d9e)
2022-02-04T13:44:45.651 [Information] Trigger Details: MessageId: b5c1ff28-4ffe-42ab-b445-6d3468ceab80, SequenceNumber: 274, DeliveryCount: 1, EnqueuedTimeUtc: 2022-02-04T13:44:45.2580000Z, LockedUntilUtc: 9999-12-31T23:59:59.9999999Z, SessionId: f4ad5f78-c74c-4e66-aea9-f4d9bb5de2ac
2022-02-04T13:44:45.951 [Information] Executing 'Functions.ServiceBusTriggerAnalytics' (Reason='(null)', Id=90b18065-3ae1-42f6-a42e-dfca8e58d83a)
2022-02-04T13:44:45.951 [Information] Trigger Details: MessageId: 9dd6f19f-7f05-4cf6-8f37-4283ecb324a6, SequenceNumber: 275, DeliveryCount: 1, EnqueuedTimeUtc: 2022-02-04T13:44:45.5240000Z, LockedUntilUtc: 9999-12-31T23:59:59.9999999Z, SessionId: a705b9ee-a096-4802-8ea8-04ed4ebd0e40
2022-02-04T13:44:46.265 [Information] Executing 'Functions.ServiceBusTriggerAnalytics' (Reason='(null)', Id=77765183-870a-4335-a5d4-c1f890225f93)
2022-02-04T13:44:46.265 [Information] Trigger Details: MessageId: b1d7cee2-7b76-4d42-9ad5-62595a98b638, SequenceNumber: 276, DeliveryCount: 1, EnqueuedTimeUtc: 2022-02-04T13:44:45.8050000Z, LockedUntilUtc: 9999-12-31T23:59:59.9999999Z, SessionId: c1224737-d15e-4283-b539-4d241108850f
2022-02-04T13:44:46.566 [Information] Executing 'Functions.ServiceBusTriggerAnalytics' (Reason='(null)', Id=fbf0d00e-f55a-48f7-ba8d-79336d04ed06)
2022-02-04T13:44:46.566 [Information] Trigger Details: MessageId: 3e1d8bbd-030d-4914-8f2f-7dd2c85da31f, SequenceNumber: 277, DeliveryCount: 1, EnqueuedTimeUtc: 2022-02-04T13:44:46.0710000Z, LockedUntilUtc: 9999-12-31T23:59:59.9999999Z, SessionId: 1c3c5428-f75b-43eb-b0c8-b69d57fe2392
2022-02-04T13:50:15.857 [Information] Executing 'Functions.ServiceBusTriggerAnalytics' (Reason='(null)', Id=16f95aa5-bba5-417c-9709-59bd327b4017)
2022-02-04T13:50:15.857 [Information] Trigger Details: MessageId: b5c1ff28-4ffe-42ab-b445-6d3468ceab80, SequenceNumber: 274, DeliveryCount: 2, EnqueuedTimeUtc: 2022-02-04T13:44:45.2580000Z, LockedUntilUtc: 9999-12-31T23:59:59.9999999Z, SessionId: f4ad5f78-c74c-4e66-aea9-f4d9bb5de2ac
2022-02-04T13:50:16.159 [Information] Executing 'Functions.ServiceBusTriggerAnalytics' (Reason='(null)', Id=fc6e26ef-ae26-43ea-b8ea-870ebbe1d559)
2022-02-04T13:50:16.159 [Information] Trigger Details: MessageId: 9dd6f19f-7f05-4cf6-8f37-4283ecb324a6, SequenceNumber: 275, DeliveryCount: 2, EnqueuedTimeUtc: 2022-02-04T13:44:45.5240000Z, LockedUntilUtc: 9999-12-31T23:59:59.9999999Z, SessionId: a705b9ee-a096-4802-8ea8-04ed4ebd0e40
2022-02-04T13:50:16.792 [Information] Executing 'Functions.ServiceBusTriggerAnalytics' (Reason='(null)', Id=de722334-978a-431b-846e-2a576b4296f1)
2022-02-04T13:50:16.792 [Information] Trigger Details: MessageId: 3e1d8bbd-030d-4914-8f2f-7dd2c85da31f, SequenceNumber: 277, DeliveryCount: 2, EnqueuedTimeUtc: 2022-02-04T13:44:46.0710000Z, LockedUntilUtc: 9999-12-31T23:59:59.9999999Z, SessionId: 1c3c5428-f75b-43eb-b0c8-b69d57fe2392
2022-02-04T13:50:37.015 [Information] Executed 'Functions.ServiceBusTriggerAnalytics' (Succeeded, Id=f9141e9b-149a-4bb9-9d50-90b880662d9e, Duration=351364ms)
2022-02-04T13:53:00.894 [Information] Executed 'Functions.ServiceBusTriggerAnalytics' (Succeeded, Id=fbf0d00e-f55a-48f7-ba8d-79336d04ed06, Duration=494328ms)

Let me know if anyone can help me in this.

Azure Service Bus
Azure Service Bus
An Azure service that provides cloud messaging as a service and hybrid integration.
553 questions
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,321 questions
{count} votes

1 answer

Sort by: Most helpful
  1. MughundhanRaveendran-MSFT 12,431 Reputation points
    2022-02-14T06:21:31.823+00:00

    @Singh, Satyam ,

    For functions on consumption plan, the maximum timeout value that can be set is 10 minutes. For Dedicated and Premium plans, you can set to 30 minutes or more.

    Please try to increase the maxAutoRenewDuration value and match it with the function timeout value. According to the below github issue, it appears that the maxAutoRenewDuration can be set more than 5 minutes

    https://github.com/Azure/azure-functions-host/issues/6500

    I hope this helps!

    Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.