Description
On Linux environments, a race condition may lead the host to initialize placeholder (warmup
) function.
Repro steps
-
Deploy a function app in Flex Consumption with a worker that will fail initialization (e.g., crash at startup)
-
The platform will restart the host. During the restart, the LinuxInstanceManager.StartAssignment logic runs, which pushes site assignment to a background task (see the line of code here).
-
Because this assignment call is “fire and forget,” the environment variable indicating the host is no longer in placeholder mode sometimes isn’t set before the host initialization proceeds.
-
The host detects placeholder mode environment settings and incorrectly indexes the placeholder (warmup) function.
Expected behavior
The host should wait for the assignment to complete before initializing the JobHost
so placeholder information (as well as application settings) is correctly applied. As a result, it should not index the placeholder/warmup function if the assignment step has actually completed.
Actual behavior
Due to the race condition, the host sometimes sees the environment as still in placeholder mode because the assignment logic hasn’t finished setting the appropriate environment variables. This leads the host to index the placeholder function incorrectly.