Azure / Azure/azure-functions-host

Allow customization of specialization timeout value & Improve log message

Open
#10,482 3 comments 3 reactions 0 assignees View on GitHub
area: flex-consumption enhancement supportability
Dominant language
C#
Stars
2k
Forks
482
Avg merge
2d 12h
Merged PRs (30d)
38

Description

For out-of-process language workers, the specialization process (environment reload request) has a [30-second timeout](https://github.com/Azure/azure-functions-host/blob/91e0bf7eca21fb9bb380450cf9d148745b0f4870/src/WebJobs.Script/Workers/ProcessManagement/WorkerProcessCountOptions.cs#L48). If a customer's function app takes longer than 30 seconds to start, the timeout will trigger, resulting in an exception like the one below in the logs

> System.AggregateException : One or more errors occurred. (The operation has timed out.) ---> The operation has timed out. ---> (Inner Exception #0) System.TimeoutException : The operation has timed out. at Microsoft.Azure.WebJobs.Script.Grpc.GrpcWorkerChannel.PendingItem.OnTimeout() at /src/azure-functions-host/src/WebJobs.Script.Grpc/Channel/GrpcWorkerChannel.cs : 1799 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.Azure.WebJobs.Script.Workers.Rpc.WebHostRpcWorkerChannelManager.SpecializeAsync() at /src/azure-functions-host/src/WebJobs.Script/Workers/Rpc/WebHostRpcWorkerChannelManager.cs : 134 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at async Microsoft.Azure.WebJobs.Script.WebHost.StandbyManager.SpecializeHostCoreAsync() at /src/azure-functions-host/src/WebJobs.Script.WebHost/Standby/StandbyManager.cs : 117<---

Currently, there is no way for customers to configure this timeout. A solution is needed to allow customization of this value. Additionally, the exception message should be improved for clarity, indicating that the specialization has failed if the app takes more than 30 seconds to start.

For now, .NET Isolated customers can work around this issue by disabling the specialization code path. This can be done by setting the `WEBSITE_USE_PLACEHOLDER_DOTNETISOLATED` app setting to `0`

Contributor guide

Open the contributing guide

Research direction

Start with WorkerProcessCountOptions.cs at the linked specialization timeout, then trace the timeout and exception through GrpcWorkerChannel.cs, WebHostRpcWorkerChannelManager.cs, and StandbyManager.cs. Done means the specialization timeout can be customized and the resulting log clearly identifies specialization failure when startup exceeds the configured value.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp
Domain
backend, cloud
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.