Azure / Azure/azure-functions-host

Specialization race can lead to error with "Did not find functions with language..." error

Open
#9,477 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
2k
Forks
482
Avg merge
2d 12h
Merged PRs (30d)
38

Description

There are rare cases during specialization where Antares may select a placeholder host before it has been fully initialized. This can lead to an issue where the `AppServiceOptions` (and perhaps other options?) are initialized with incorrect values as the ScriptHost is being created.

This means that the WebHost would have a version of `AppServiceOptions` that (for example) contains the placeholder's name as AppName in the WebHost... and the customer's app name in the ScriptHost. This can lead to a lot of weirdness with this mismatch.

This issue arises because of how our parent/child DI container works with `IOptions<>`. It re-initializes the options even though they've been initialized in the WebHost.

My initial thought is that we need to ensure that we use the same `AppServiceOptions` in both WebHost and ScriptHost and avoid any direct lookups of environment variables as they may be changing as we flow through the initialization.

Contributor guide

Open the contributing guide

Research direction

No files or tests are identified. Start by tracing specialization, placeholder-host selection, and parent/child DI initialization of AppServiceOptions across WebHost and ScriptHost; reproduce the race if possible. Done means both hosts consistently use the intended options during initialization, including the correct AppName.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.