-
When upgrading a .netcoreapp3.1 to .net6 on lambda, I noticed that lambda now handles the requests in a different thread than the function initialization. Using the test below, I can see that the .net3.1 runtime executes the function constructor and the functionHandler on the same thread and the async value is maintained. Executing the same test on .net6 we can see that the constructor is called on a different thread than the functionHandler and the async value is not retained. Here is the sample code:
Output on .net3.1 runtime:
output on .net6 runtime:
Does anyone know the reason for this change and if it was documented anywhere? I don't see it in the blog post which has upgrade steps: https://aws.amazon.com/blogs/compute/introducing-the-net-6-runtime-for-aws-lambda/ |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
For .NET 6 we switched to our open source version of the Lambda runtime client written in C# from the previous internal Lambda runtime client which was written largely in C. We called this out in the mentioned blog post of the switch knowing there would some subtle changes in behavior like this. The fact that 3.1 called the constructor on the same thread as the function handler was never an intentional design goal. Sorry if this change in behavior is causing you issues. |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
For .NET 6 we switched to our open source version of the Lambda runtime client written in C# from the previous internal Lambda runtime client which was written largely in C. We called this out in the mentioned blog post of the switch knowing there would some subtle changes in behavior like this. The fact that 3.1 called the constructor on the same thread as the function handler was never an intentional design goal. Sorry if this change in behavior is causing you issues.