aspire: Azure Function not loaded with specific host settings - logging
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
When I use the Azure Function in Aspire, a strange behavior occurs when I have this block in host.json. It happened in the previous version 9.0 as I mention here and it happens now in version 9.1.0-preview.1.24561.5.
What happens is that Aspire starts and shows the function loading, which eventually doesn’t load and after 120 seconds it throws Failed to start. I used the example repository for Azure Function in Aspire.
I prepared repository - https://github.com/petrkasnal/AspireHostProblem
{
"version": "2.0",
"logging": {
"logLevel": {
"Default": "Debug", // If enable function isnt load
"System": "Information",
"Microsoft": "Information"
},
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
},
"enableLiveMetricsFilters": true
}
}
}
fail: Aspire.Hosting.Dcp.dcpctrl.ExecutableReconciler[0]
timeout of 120 seconds exceeded waiting for the IDE to start a run session; you can set the DCP_IDE_REQUEST_TIMEOUT_SECONDS environment variable to override this timeout (in seconds) {"Executable": {"name":"funcapp-czmfpfza"}, "Reconciliation": 2, "error": "Put \"https://localhost:64604/run_session?api-version=2024-04-23\": context deadline exceeded"}
Expected Behavior
I would expect the logging settings to have no effect on Azure function execution. It’s holding us back now because I have to keep overwriting it and that’s not very convenient.
Steps To Reproduce
Open repository - https://github.com/petrkasnal/AspireHostProblem Run AzureFunctionsTest.AppHost project
If you edit host.json - comment line “Default”: “Debug” and starts work
Exceptions (if any)
No response
.NET Version info
9.0.0-rc.2.24473.5
Anything else?
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 31 (20 by maintainers)
We believe we’ve tracked down the cause of the deadlock that is causing the original issue here. Essentially, nothing was reading from the console output of the host process while we waited for the worker process to launch. If there was enough output written (which was the case when logging was set to debug), the buffer would fill up and the last write attempt would be blocked, preventing the host process from eventually launching the worker process. Fix is in progress.
Ignore that tag of a PR, that was for a different fix.
We do have a fix for this issue that has been checked in and should be available with the next preview release of VS. Assuming validation goes well we can also discuss servicing 17.12 with it.
Tested and working. Thanks a lot. Great work.
VS 17.13 Preview 4 was released last week. I’ve verified that the repro shared in the original post launches successfully on this version and I see Debug level logs.
Closing as fixed. If you run into any issues, feel free to file a new bug.
@petrkasnal It will be in the next preview release of VS 17.13 when that is released. No public date of that yet but it’s not far off. I have not heard anything about servicing 17.12 at this point.
@tlmii has been taking a look at this in the background. We’ve got a reliable repro and have narrowed down that this seems to specifically be related to the Azure Functions + VS + debugging.
@tlmii has a hunch that the issue here might be related to the Functions runtime not writing some required debugging metadata to a shared source file when the debug log is enabled.
@tlmii – do you want to verify what you’ve learned here?
@davidfowl it was “start project” request from DCP
@petrkasnal OK! I was able to get a repro of the issue and extracted logs from DCP to help debug this. @karelz will share more details on this later.
Similar to the other issue you reported, this bug seems to manifest when launching from Visual Studio in particular.