-
Notifications
You must be signed in to change notification settings - Fork 238
Error when using AWS Lambda Profiler Extension #529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for reaching out @Vadym79 and for the reproducer |
@maxday I understood why it happened: the error occured in the sdk-core.jar. In build.gradle you use software.amazon.awssdk:s3:2.28.9 which then also needs sdk-core.jar. In the pom.xml of my applciation I used the higher version (2.31.1) of the bom of software.amazon.awssdk, so there are 2 different versions of sdk-core.jar in the classpath : one via Lambda layer for s3 communication and one via my application itself (dynamodb client which I use requires it). The one from the layer has priority and boom, there is a mismatch as dynamodb client requires things (like software.amazon.awssdk.core.interceptor.ExecutionAttribute BUSINESS_METRICS member field) in the sdk-core.jar which are not there in the older version. Please improve your documentation, that the usage of the different versions of all dependencies (especially of s3, but also aws-lambda-java-core and aws-lambda-java-events) for building the lambda profiler extension and in the application itself could potentially lead to such an effect. After I have fixed in in my local copy of the lambda profiler and rebuilt and redeployed the lambda layer with the profile extension I at least don't see any thrown errors. |
@Vadym79 thanks a lot for your investigation, that makes total sense. |
Closing as #530 has been merged |
I just build the AWS Lambda Profiler Extension as descibed in here, published it as a Lambda layer and used it in my sample application.
During the Lambda invocation I first saw the log message
[PROFILER] premain is starting
and then got the following error message:
You can test my using my application : build it with mvn clean package and deploy it with sam deploy. Then use AWSLambdaWithProfilerLayerJava21API in API Gateway and invoke /product PUT HTTP method with the body { "id": 1, "name": "Print 10x13", "price": 0.15 }. This application is simple: API Gateway invokes Lambda Function (PutProductWithPureJava21WithProfilerLayer) and it persists the product record into the DynamoDB table AWSLambdaWithProfilerLayerJava21ProductsTable.
If I comment the following line in the template.yaml
#JAVA_TOOL_OPTIONS: -XX:+UnlockDiagnosticVMOptions -XX:+DebugNonSafepoints -javaagent:/opt/profiler-extension.jar
which defines the agent, everything works fine. Please advice
The text was updated successfully, but these errors were encountered: