Open skyfrk opened 2 months ago
We have been experiencing the same issue with an HTTP triggered function in a .net 8 isolated worker function app running on consumption plan. We are using functions v4 and these are the packages we are referencing:
<PackageReference Include="Azure.Storage.Blobs" Version="12.20.0" />
<PackageReference Include="Contrib.Grpc.Core.M1" Version="2.46.7" />
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.22.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.DurableTask" Version="1.1.4" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.EventGrid" Version="3.4.1" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.2.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="1.3.2" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.ServiceBus" Version="5.20.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.17.2" />
<PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.22.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="1.2.0" />
<PackageReference Include="Microsoft.Extensions.Azure" Version="1.7.4" />
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.0" />
+1, we are experiencing the same issue - client cancels the request and we are seeing Failures and multiple exceptions logged on the Azure Function side.
client app happens to trigger the requests with very short timeout due to the network sockets drain on the client site (can be less than 100ms).
from the call stack on the server side (Azure Function) it looks like the user code is not triggered at all, call stack references only internal function libraries.
Azure Function v4 on Linux consumption plan. Referenced packages:
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Azure.Identity" Version="1.12.0" />
<PackageReference Include="Azure.Data.Tables" Version="12.8.3" />
<PackageReference Include="Azure.Monitor.Query" Version="1.3.1" />
<PackageReference Include="Azure.Storage.Files.DataLake" Version="12.18.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.22.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.2.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="1.3.2" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Timer" Version="4.3.1" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.17.4" />
<PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.22.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="1.2.0" />
<PackageReference Include="ParquetSharp" Version="15.0.2.1" />
<PackageReference Include="System.Drawing.Common" Version="8.0.6" />
<PackageReference Include="Microsoft.Identity.Client" Version="4.62.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.Text.Json" Version="8.0.4" />
+1. We're seeing the same problem in a couple of applications we just migrated from .NET 6 In-Proc to .NET 8 isolated on v4 Windows Consumption plans.
same issue
if you remove this package
and the below line from your program.cs
.ConfigureFunctionsWebApplication()
the functions works fine.
so what is happening is, because of those two line, the azure function is being treated as aspnetcore application
Description
We use an .NET 8 isolated function app with the default ApplicationInsights and ASP.NET Core integration (see below for the full setup).
When a request to an HTTP trigger with
CancellationToken
support is canceled by the client, multiple exceptions are logged to ApplicationInsights:TaskCanceledException
.System.Net.Sockets.SocketException
withCategory
Functions.<FunctionName>
.System.Net.Sockets.SocketException
withCategory
Host.Results
.When a client cancels a request, we would like to handle that without logging exceptions to ApplicationInsights.
The
TaskCanceledException
exception can be caught and handled in a middleware like this:The
System.Net.Sockets.SocketException
exceptions however can only be filtered by filtering whole categories in thehost.json
:Unfortunately these categories contain other logs as well that one might not want to be filtered (e.g. request logs).
So since there is no way to suppress these
System.Net.Sockets.SocketException
exceptions that are thrown by the host for canceled requests, I'd say that this is a bug.Example of a
System.Net.Sockets.SocketException
thrown by the host:Steps to reproduce
Function App Setup
FunctionApp1.csproj
Program.cs
Function1.cs
host.json
local.settings.json
Client Setup