azure-functions-core-tools
azure-functions-core-tools copied to clipboard
Stopping a locally running .NET 8 In-Process Azure Function App not closing all processes
I am in the process of upgrading our Azure Function App from .NET 6 In-Process to .NET 8 In-Process. During this upgrade, I began encountering an issue where the function app would not close all func processes when it is stopped. Because of file locks and ports, I am unable to restart my function app without manually killing the process from Task Manager. It seems to always happen if I have "FUNCTIONS_INPROC_NET8_ENABLED": "1" in my local settings (even after reverting the rest to .NET 6).
Running func host start
(Also note the text which used to have colors is all gray)
Closing Function App with Ctrl + C
func process still running in Task Manager
I have also made all changes outlined at the bottom of this comment. https://github.com/Azure/azure-functions-host/issues/9951#issuecomment-2174365098
@mddouros-msigh If you do func host start again, is that not terminating the orphan process (and start a new process)?
It appears that when I run func host start from the console, the orphaned process is terminated - so this is more likely an issue with debugging in VS Code. Looking closer, I see that the issue is actually with running dotnet build as a preliminary step to func host start while the orphaned process is still running. It seems the orphaned process retains a lock on a dll for one of our library projects.
I did also try changing tasks.json to only include the func host start step which results in the following error:
Port 7071 is unavailable. Close the process using that port, or specify another port using --port [-p].
Here are the launch.json and tasks.json file contents
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach to .NET Functions",
"type": "coreclr",
"request": "attach",
"processId": "${command:azureFunctions.pickProcess}"
}
]
}
{
"version": "2.0.0",
"tasks": [
{
"label": "clean",
"command": "dotnet",
"args": [
"clean",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"type": "process",
"problemMatcher": "$msCompile"
},
{
"label": "build",
"command": "dotnet",
"args": [
"build",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"type": "process",
"dependsOn": "clean",
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": "$msCompile"
},
{
"label": "clean release",
"command": "dotnet",
"args": [
"clean",
"--configuration",
"Release",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"type": "process",
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"args": [
"publish",
"--configuration",
"Release",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"type": "process",
"dependsOn": "clean release",
"problemMatcher": "$msCompile"
},
{
"type": "func",
"dependsOn": "build",
"options": {
"cwd": "${workspaceFolder}/bin/Debug/net8.0"
},
"command": "host start",
"isBackground": true,
"problemMatcher": "$func-watch"
}
]
}
Do you have any suggestions for how to fix this? This same config worked in .NET 6 but now the file locks are preventing re-building while the orphaned func process is still running.
I just rand into this issue myself using Rider on W11. I updated the Azure Toolkit plugin, and it went away immediately. Hope this helps.
Closing this as the latest version of Core Tools has resolved the issue. If you're still experiencing problems with the latest version, please feel free to open a new issue.