Support IDisposable for Function Handlers
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
Línea de trabajo
Comienza revisando el comportamiento del handler de Amazon.Lambda.Core 2.7.1 y el ciclo de vida de SIGTERM descrito en este issue; después, compáralo con el issue 342 anterior. Se considera terminado cuando el runtime proporciona una forma definida de hacer dispose de los function handlers cuando Lambda envía SIGTERM, incluida la limpieza, como vaciar los logs o cerrar las conexiones.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the feature
It's the same feature request as https://github.com/aws/aws-lambda-dotnet/issues/342 - to dispose function handler when Lambda service deletes the execution environment.
It was closed because there was no hook from lambda service at that time. But now there is - Lambda sends SIGTERM to runtime before reclaiming the environment.
Use Case
Any features which requires some cleanup.
Flushing logs and traces, closing DB connections, etc.
Proposed Solution
I have implemented it for my handlers via smth like that:
public abstract class AbstractLambdaHandler : IDisposable
{
private readonly PosixSignalRegistration sigTermRegistration;
protected AbstractLambdaHandler()
{
// AWS Lambda service sends SIGTERM signal before killing lambda container, but
// lambda-dotnet runtime does not handle it yet - https://github.com/aws/aws-lambda-dotnet/issues/342 .
// Until it is implemented, we use custom signal registration to dispose lambda handler.
sigTermRegistration = PosixSignalRegistration.Create(PosixSignal.SIGTERM, _ =>
{
Logger?.LogDebug("SIGTERM signal received. Disposing Lambda Handler.");
Dispose();
});
}
public virtual void Dispose()
{
sigTermRegistration?.Dispose();
// Dispose other things.
}
}
It would be nice to have it provided by the runtime itself though.
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.Core 2.7.1
Targeted .NET Platform
.NET 8
Operating System and version
AmazonLinux
- Lenguaje dominante
- C#
- Estrellas
- 1.7k
- Forks
- 504
- Merge medio
- 2 d 9 h
- PR fusionados (30 d)
- 9
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de aws/aws-lambda-dotnet
-
bug module/aspnetcore-support p2 queued
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
aws/aws-lambda-dotnet#1123 · 4 comentarios · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Annotate auto-generated codeAbiertofeature-request needs-triage
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
aws/aws-lambda-dotnet#2588 ·
Los mantenedores suelen responder en 1 día
-
Generated XML doc `cref` contains unescaped generic arguments: CS1584 / CS1658 / CS1570 warningsPosiblemente ocupada @reginaldalfret la tomó hace 1 día. Abiertobug needs-triage
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
aws/aws-lambda-dotnet#2587 ·
Los mantenedores suelen responder en 1 día
-
bug needs-triage
Dificultad 3/5 1-2 días Aptitud para principiantes 67/100
aws/aws-lambda-dotnet#2586 ·
Los mantenedores suelen responder en 1 día
-
feature-request p2
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
aws/aws-lambda-dotnet#2551 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de aws/aws-lambda-dotnet
Issues similares
-
VideoViewer: rotated (portrait phone) videos shown sideways when system decimal separator is a commaAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Volodymyr-Petrunin/Bankomaten#45 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
AvaloniaUI/Avalonia#22420 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
dotnet/SqlClient#4823 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
type/automation type/tech-debt
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día