Azure / Azure/azure-functions-dotnet-worker
Make `FunctionStartTimeoutInSeconds` (and related HTTP-coordinator time-outs) configurable
- Dominant language
- C#
- Stars
- 466
- Forks
- 215
- Avg merge
- 3d 10h
- Merged PRs (30d)
- 7
Description
### Description
## Why
Please make time-out parameters such as `FunctionStartTimeoutInSeconds` configurable so that functions can run in environments where longer startup delays are acceptable.
## What
The `FunctionStartTimeoutInSeconds` is hard-coded to 15 seconds, and the same applies to `HttpContextTimeoutInSeconds` and `FunctionContextTimeoutInSeconds`.
If startup might exceed these fixed values due to factors like resource constraints or machine specifications, then these constants may be too strict for environments where longer wait times are acceptable.
The following constants are [hard-coded](https://github.com/Azure/azure-functions-dotnet-worker/blob/cf017816a0fdcfcba8f179daf352f49d33a1fae3/extensions/Worker.Extensions.Http.AspNetCore/src/Coordinator/DefaultHttpCoordinator.cs#L14-L16):
```
private const int HttpContextTimeoutInSeconds = 5;
private const int FunctionContextTimeoutInSeconds = 5;
private const int FunctionStartTimeoutInSeconds = 15;
```
If the `FunctionStartTimeoutInSeconds` limit is exceeded, the function fails with a timeout error.
An example message is as follows:
`Timed out waiting for the function start call. Invocation: '{invocationId}'.` ref https://github.com/Azure/azure-functions-dotnet-worker/blob/cf017816a0fdcfcba8f179daf352f49d33a1fae3/extensions/Worker.Extensions.Http.AspNetCore/src/Coordinator/DefaultHttpCoordinator.cs#L55
Here is a sample log from a real occurrence:
```log
Timestamp : 5/1/2025 9:06:54 AM
Inner Exception Type: Microsoft.Azure.WebJobs.Script.Workers.Rpc.RpcException
Total Occurrences: 18
Latest Exception Message: Result
/Failure Exception
/Timed out waiting for the function start call. Invocation
/'2ff4f8fd-19ad-4bf9-b5bf-11cf141fe334'.
/
Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore.DefaultHttpCoordinator.SetFunctionContextAsync(String invocationId, FunctionContext context) in D:\a\_work\1\s\extensions\Worker.Extensions.Http.AspNetCore\src\Coordinator\DefaultHttpCoordinator.cs:line 67
Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore.FunctionsHttpProxyingMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a\_work\1\s\extensions\Worker.Extensions.Http.AspNetCore\src\FunctionsMiddleware\FunctionsHttpProxyingMiddleware.cs:line 45
... (stack trace truncated) ...
```
I would like to request that time-out parameters such as `FunctionStartTimeoutInSeconds` be made configurable—within reasonable upper and lower bounds—so that they can accommodate environments where longer wait times are acceptable.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with extensions/Worker.Extensions.Http.AspNetCore/src/Coordinator/DefaultHttpCoordinator.cs, especially the hard-coded timeout constants and the timeout handling around SetFunctionContextAsync. Determine how configuration and reasonable bounds should be represented, then verify that the coordinator uses the configured values and that the documented timeout failures still behave correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100