Use ILambdaContext.RemainingTime to create a valid CancellationToken for AspNetCoreServer Requests
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start by tracing how Amazon.Lambda.AspNetCoreServer.Hosting 1.5.0 creates the AspNetCoreServer request CancellationToken and accesses ILambdaContext. Define cancellation behavior around ILambdaContext.RemainingTime, including the near-zero threshold, then verify that long-running request work observes cancellation before Lambda timeout and that reused Lambdas do not continue background retries.
Written by the indexing model from the issue text.
Description
Describe the feature
Currently when a Lambda execution times out, a AspNetCore request continues to execute even if it is checking a CancellationToken parameter for cancellation.
This feature would create a new CancellationTokenSource using ILambdaContext.RemainingTime and request cancellation when remaining time reaches or nears zero. This would allow consumer code to cancel long running operations in a way that is more controlled. This would create similar functionality to how timeouts are handled in Kestrel and IIS
Use Case
Due to upstream concurrency limitations, we sometimes have a lambda AspNetCore request timeout. Since the CancellationToken passed into the request is never cancelled, we continue to try to execute retry requests in the background if a lambda is reused.
Proposed Solution
No response
Other Information
No response
Acknowledgements
- I may be able to implement this feature request
- This feature might incur a breaking change
AWS .NET SDK and/or Package version used
Amazon.Lambda.AspNetCoreServer.Hosting 1.5.0
Targeted .NET Platform
net6.0
Operating System and version
AmazonLinux (Lambda)
- Dominant language
- C#
- Stars
- 1.7k
- Forks
- 503
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 14
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from aws/aws-lambda-dotnet
-
bug p2
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
aws/aws-lambda-dotnet#2571 · 1 comment ·
Maintainers usually reply within 1 day
-
bug module/aspnetcore-support p2 queued
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
aws/aws-lambda-dotnet#1123 · 4 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
feature-request p2
Difficulty 4/5 3-5 days Newbie friendliness 68/100
aws/aws-lambda-dotnet#2583 ·
Maintainers usually reply within 1 day
-
feature-request p2
Difficulty 4/5 3-5 days Newbie friendliness 68/100
aws/aws-lambda-dotnet#2572 · 1 comment ·
Maintainers usually reply within 1 day
-
feature-request p2
Difficulty 4/5 3-5 days Newbie friendliness 48/100
aws/aws-lambda-dotnet#2551 · 1 comment ·
Maintainers usually reply within 1 day
All issues in aws/aws-lambda-dotnet
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
lay295/TwitchDownloader#1675 ·
-
copilot documentation
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
space-wizards/RobustToolbox#7119 ·
Maintainers usually reply within 1 day
-
Bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 4 days
-
.NET Bug Waiting for: Product Owner
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
getsentry/sentry-dotnet#5666 · 2 comments ·
Maintainers usually reply within 2 days