Skip to content

.Net7 Minimal API running under provider.al2 runtime timeout on quick fire successive requests  #1543

Open
@Simonl9l

Description

@Simonl9l

Describe the bug

Related to discussion #1424, but figure an Issue might garner more attention, since prior response there were stale and now have a reproducible sample.

In summary we have a .Net 7 Minimal API setup (serverless.AspNetCoreMinimalAPI) switched to .Net7 and using the amazon.lambda.tools to build the package using the docker image process via the -ucfb True option.

Our sense is that in .Net7 the Host/Middleware, or something related to its interaction with the provider.al2 runtime that may have changed with the newer .Net version is now possibly incompatible the .AddAWSLambdaHosting middleware.

Expected Behavior

Successive and continuous request should complete successfully

Current Behavior

Once deployed we find:

  • that the default route / can be continuously quick-fired without error.
  • that other requests like /calculator/add/1/2 initially succeeds but then fail after ~3-5 rapid requests with a timeout, as set by the lambda deployment (30 secs in our case).
  • If the invocations are spaced out ( at ~30 second intervals) the successive requests continue to work successfully.

Reproduction Steps

We have a GitHub workflow enabled clone-able/deployable repo here with instructions here

We have used the default template samples so that we can eliminate if any of our code is introducing a side effect, and whist we had added some of that code it's commented out.

Possible Solution

We need to migrate to .Net7 such that we can use latest C# features.

Additional Information/Context

We note comments in the RuntimeSupport.Client.InvocationResponse there is special handling of the OutputStream for successive invocations, but are unsure of the implication in this scenario, and assume this in an optimization.

Of note:

  • The / (default) route request in the Map does not leverage any default middleware where as the other routes to map the request on the controller do.
  • Whist Net7.0 is not explicitly supported for minimal API, given the lambda.NativeAOT template, we assume basic compatibility with the provider.al2 custom runtime
  • We have set <PublishAot>false</PublishAot> in the csproj, to eliminate any concern that this my be an issue.

AWS .NET SDK and/or Package version used

Amazon.Lambda.AspNetCoreServer.Hosting - 1.6.0
AWSSDK.Extensions.NETCore.Setup - 3.7.7
Amazon.Lambda.RuntimeSupport - 1.8.8
Amazon.Lambda.Core" Version - 2.1.0
Amazon.Lambda.Serialization.SystemTextJson - 2.3.1

Targeted .NET Platform

.Net 7

Operating System and version

AmazonLinux

Metadata

Metadata

Assignees

No one assigned

    Labels

    annotationsbugThis issue is a bug.needs-reproductionThis issue needs reproduction.p2This is a standard priority issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions