[Lambda] Support for a Function Shutdown lifecycle phase
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- aws
- Domain
- cloud
Research direction
Start with the AWS Lambda runtime-environment documentation and compare the documented INIT and SHUTDOWN phases. Review the aws-samples/graceful-shutdown-with-aws-lambda workaround and the note that Lambda extensions can participate in shutdown. Done means the roadmap request has a defined, officially supported path for function cleanup, with updated documentation and no required extension workaround.
Written by the indexing model from the issue text.
Description
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Tell us about your request
Lambda Functions currently have support for a Function Init step as part of the INIT phase as outlined here
This step is most commonly used for establishing connections to other resources such as Databases
However, there is no equivalent Function Shutdown step as part of the SHUTDOWN phase.
This could be used to add symmetry to Init where database connections can be closed.
Which service(s) is this request for?
AWS Lambda
Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?
We want to be able to manage our database connections in a cleaner manner. Currently Lambdas can open database connections on Init, but we have no clean way of closing the connection.
Either we open and close the connection as part of the request, or, we leave the connection open and wait for the server to close it after it is marked as idle.
This creates connection management issues with servers where there appears to be a larger number of in-use connections than there really are.
Allowing the Lambda code to participate in the Shutdown phase would allow the function to clean up after itself and better manage system resources.
Are you currently working around this issue?
We carefully manage various client connection settings such as idle timeouts, and live with the fact that our number of open connections is often not completely representative of active connections.
Additional context
Lambda extensions are able to participate in Shutdown, it appears that it is just function code that cannot officially do that.
However, there are documented workarounds such as those found in aws-samples/graceful-shutdown-with-aws-lambda. So it doesn't feel like a stretch to make this an officially supported behaviour with more explicit documentation and no requirement for an extension to first be added.
Attachments
If you think you might have additional information that you'd like to include via an attachment, please do - we'll take a look. (Remember to remove any personally-identifiable information.)
- Dominant language
- No language data
- Stars
- 196
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Contributor 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-roadmap
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
aws/aws-lambda-roadmap#101 ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
aws/aws-lambda-roadmap#100 ·
-
Difficulty 5/5 Over a week Newbie friendliness 28/100
aws/aws-lambda-roadmap#97 · 1 comment · 1 reaction ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
aws/aws-lambda-roadmap#96 · 1 reaction ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
aws/aws-lambda-roadmap#95 · 1 comment · 1 reaction ·
All issues in aws/aws-lambda-roadmap
Similar issues
-
Language: Terraform :globe_with_meridians: Needs: Triage :mag: Type: Bug :bug:
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Azure/terraform-azurerm-avm-res-containerregistry-registry#230 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
level/task module/gcp type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100