Functions V2: host.json "extensions" not loading, autoRenewTimeout lock issue
See original GitHub issueHi, I am having troubles with my host.json-file, in particular, by loading the contents under the “extensions” tag in the file when having a Azure Function (AF) V2: Service Bus Trigger.
I have cross checked by creating a simple AF V1 and used the following input in my host.json-file:
{
"serviceBus": {
"maxConcurrentCalls": 1,
"autoRenewTimeout": "00:25:00"
}
}
When spinning up my AF, I am seeing the following image:
Giving me an indication that it is loaded. I can see that it behaves like I want by handling concurrent calls and locks.
Moving on to V2:
When setting the following text in my host.json-file (Source: :
{
"version": "2.0",
"extensions": {
"eventHubs": {
"maxBatchSize": 64,
"prefetchCount": 256,
"batchCheckpointFrequency": 1
},
"http": {
"routePrefix": "api",
"maxConcurrentRequests": 5,
"maxOutstandingRequests": 30
},
"queues": {
"visibilityTimeout": "00:00:10",
"maxDequeueCount": 3
},
"sendGrid": {
"from": "Azure Functions <samples@functions.com>"
},
"serviceBus": {
"maxConcurrentCalls": 1,
"autoRenewTimeout": "00:25:00"
}
},
"healthMonitor": {
"enabled": true,
"healthCheckInterval": "00:00:10",
"healthCheckWindow": "00:02:00",
"healthCheckThreshold": 6,
"counterThreshold": 0.80
},
"id": "9f4ea53c5136457d883d685e57164f08",
"logging": {
"fileLoggingMode": "debugOnly",
"logLevel": {
"Function.MyFunction": "Information",
"default": "None"
},
"applicationInsights": {
"sampling": {
"isEnabled": true,
"maxTelemetryItemsPerSecond" : 5
}
}
},
"watchDirectories": [ "Shared", "Test" ]
}
I see:
Giving me an indication that everything is loaded BUT the children of “extensions”. Ofcourse, I understand that this might be loaded some how but the AF V2 does not behave how I want, not with concurrent queue, nor with autoRenewTimeout.
So I am looking for assistance on how to handle host.json-files with AF V2, especially autoRenewTimeout is what I am looking for. I have read several threads about this being an issue, but I have set a higher value than the lock of my topic/subscription, but yet it does not renew, leading to a lock exception.
Repro steps
Provide the steps required to reproduce the problem
1. Create a AF V1:
I use the following code:
[FunctionName("Function1")]
public static void Run([ServiceBusTrigger("%CpamTopicName%", "%CpamSubscription%", Connection = "CpamServiceBusConnection")]BrokeredMessage mySbMsg, TraceWriter log)
{
log.Info($"C# ServiceBus topic trigger function processed message: {mySbMsg}");
try
{
for (int i = 0; i < 100; i++)
{
Thread.Sleep(3000);
log.Info("number of i: " + i.ToString());
}
log.Info("Happy days!");
mySbMsg.Complete();
}
catch (Exception e)
{
;
}
}
2. Create AF V2 with the following code:
[FunctionName("Function1")]
public static void Run([ServiceBusTrigger("%CpamTopicName%", "%CpamSubscription%", Connection = "CpamServiceBusConnection")]string mySbMsg, ILogger log)
{
log.LogInformation($"C# ServiceBus topic trigger function processed message: {mySbMsg}");
try
{
for (int i = 0; i < 100; i++)
{
Thread.Sleep(3000);
log.LogInformation("number of i: " + i.ToString());
}
log.LogInformation("Happy days!");
}
catch (Exception e)
{
;
}
}
Expected behavior
In AF V2: Output logs, on a single handled run, incrementing for a long time, as well as not throwing lock exception.
Actual behavior
It is processing 3 messages at the same time, indicating that it ignores the “extensions” declared in the host.json-file.
And eventually ends up throwing lock exceptions, due to no renewals:
Known workarounds
I don’t know any, possibly rollbacking to AF V1(?).
Related information
I have researched this issue for a few days, regarding the autoRenewalTimeout and have read several clever responses from sources, especially from @SeanFeldman, regarding this and hopefully he can provide insights here.
A few Related links on issue regarding autoRenewalTimeout: SO regarding expiring lock GitHub issue regarding locks
- Package version
AF V1: Microsoft.Azure.WebJobs.ServiceBus (2.2.0) Microsoft.NET.Sdk.Functions (1.0.14)
AF V2: Azure Functions Core Tools (2.0.3) Functions Runtime Version (2.0.12115.0) Microsoft.Azure.WebJobs.Extensions.ServiceBus (3.0.0) Microsoft.NET.Sdk.Functions (1.0.22) NETStandardLibrary (2.0.3)
I am desperately looking for someone to shine any insights on this issue, and I will closely follow this issue and answer any questions anyone might have.
Thanks, L
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (3 by maintainers)
Top GitHub Comments
CASE CLOSED! Hi again @paulbatum,
I can now update with the information you gave me, I researched the documentation and found the MessageHandlerOptions to have an updated name for the autoRenewTimeout as well. I tried using that and voilá, it worked!
For anyone running into the same issue the host.json file for AF V2 should be maxAutoRenewDuration instead of autoRenewTimeout.
See example file below:
Thanks a lot for the assistance and efforts put into this 😃 Closing thread!
So it looks like our documentation needs to be updated. Try this:
(yes, WellKnownHostJsonProperties needs to be updated but that is only impacting logging)