fix: Resolve Lambda auto-instrumentation race condition#3508
Merged
tippmar-nr merged 9 commits intomainfrom Apr 2, 2026
Merged
fix: Resolve Lambda auto-instrumentation race condition#3508tippmar-nr merged 9 commits intomainfrom
tippmar-nr merged 9 commits intomainfrom
Conversation
…sponse Wrap the Lambda bootstrap handler to create the transaction early and ensure it completes before the runtime sends a response. This prevents a race condition where async continuations could run out of order, causing the Lambda runtime to return before the agent generates a payload. Also fixes duplicate "Test" in auto-instrumentation test class names, adds net10.0 TFM support with version-specific RuntimeSupport packages, and fixes a missing comma in Dotty packageInfo.json.
Multi-TFM Web SDK projects fail MSBuild solution-level DeployOnBuild with NETSDK1129. The CI pre-publish step already handles per-TFM publishing correctly.
DeployOnBuild=false in the csproj is overridden by the command-line -p:DeployOnBuild=true. IsPublishable=false prevents the Publish target from running regardless of command-line properties.
Microsoft.NET.Sdk.Web hooks into the Build target via DeployOnBuild, which fails for multi-TFM projects (NETSDK1129). Command-line properties cannot be overridden by the project file. Switch to Microsoft.NET.Sdk with an explicit FrameworkReference to Microsoft.AspNetCore.App and add a GlobalUsings.cs for the implicit usings that Web SDK previously provided.
…ption The AwsLambda wrapper now depends on Amazon.Lambda.RuntimeSupport, which is not present in non-Lambda applications. Add all three AwsLambda wrapper names to the dynamic load list so the assembly is only loaded when running in a Lambda environment.
…umentation-race-condition
nrcventura
reviewed
Apr 1, 2026
src/Agent/NewRelic/Agent/Extensions/Providers/Wrapper/AwsLambda/HandlerMethodWrapper.cs
Outdated
Show resolved
Hide resolved
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3508 +/- ##
==========================================
- Coverage 81.82% 81.79% -0.03%
==========================================
Files 508 508
Lines 34220 34220
Branches 4040 4040
==========================================
- Hits 27999 27990 -9
- Misses 5254 5265 +11
+ Partials 967 965 -2
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
nrcventura
approved these changes
Apr 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
EnsureTransformCompletesWrapperthat wraps the Lambda bootstrap handler to create transactions early and ensure they complete before the runtime sends a response, fixing an async race condition where payloads could be lostHandlerMethodWrapperto the new wrapper;HandlerMethodWrappernow only sets the transaction name on the existing transactionAmazon.Lambda.RuntimeSupportpackagesAmazon.Lambda.RuntimeSupportare testedAmazon.Lambda.RuntimeSupportin the list of packages it updates.Fixes #3473