-
Notifications
You must be signed in to change notification settings - Fork 455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure child worker processes are monitored after specialization #7974
Conversation
@@ -69,7 +69,7 @@ public void Configure(string name, ScriptApplicationHostOptions options) | |||
options.IsStandbyConfiguration = true; | |||
} | |||
|
|||
options.IsFileSystemReadOnly = IsZipDeployment(out bool isScmRunFromPackage); | |||
options.IsFileSystemReadOnly |= IsZipDeployment(out bool isScmRunFromPackage); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To test this fix, I had to simulate specialization locally. That requires configuration that ensures placeholder channels are used. For this specific change, the check here requires a RO file system. So I'm making this change to facilitate testability, however it's a logical change to make regardless.
await _hostService.StartAsync(CancellationToken.None); | ||
|
||
// add general post startup validations here | ||
mockEventManager.Verify(_ => _.Publish(It.IsAny<HostStartEvent>()), Times.Once()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this StartAsync test so I had a place to add verification for the new event
5377844
to
92b8b1e
Compare
92b8b1e
to
b5eecfa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Added minor comment!
Currently, child worker processes are only registered for monitoring when the process is started. That's a problem if the host is started in placeholder mode and later specialized. In that case, the worker channels are NOT restarted, and the child processes are not registered for monitoring by the new specialized host instance.
For testing, I've configured my local functions host to start in placeholder mode. I can see that placeholder worker channels are used. After triggering specialization, I can see the worker channels are specialized. Previously before my fix, the newly restarted/specialized host wouldn't be monitoring the child processes, because the were only registered on process start before. Now the worker process instance handles the HostStartEvent and registers.
Caught this issue in production testing. For a Python Consumption app, after specialization only the main host process is being monitored, not the worker process. That impacts DynamicConcurrency - it's unable to make correct concurrency decisions because it doesn't have a full view of CPU usage. In previous rounds of testing, I was testing with private site extensions, with placeholders disabled.
Will send a PR backporting to v3 as well, once this one is signed off on.
Pull request checklist
release_notes.md