Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

custom_resources: AwsCustomResource deadlocks sporadically #29026

Open
rittneje opened this issue Feb 8, 2024 · 4 comments
Open

custom_resources: AwsCustomResource deadlocks sporadically #29026

rittneje opened this issue Feb 8, 2024 · 4 comments
Labels
@aws-cdk/custom-resources Related to AWS CDK Custom Resources bug This issue is a bug. effort/medium Medium work item – several days of effort p3

Comments

@rittneje
Copy link

rittneje commented Feb 8, 2024

Describe the bug

We are using AwsCustomResource to execute s3:deleteBucketInventoryConfiguration on delete. We have observed sporadic failures that cause CloudFormation to end up hitting its one hour timeout because the custom resource never responds.

Looking in the logs for the custom resource lambda that CDK autogenerates, we see the task repeatedly time out after 120 seconds. There are no other logs. As per CloudTrail, the call to S3 is never even made.

Expected Behavior

The custom resource should work.

Current Behavior

It sporadically gets stuck and never responds.

Reproduction Steps

custom_resources.AwsCustomResource(
    scope,
    id,
    install_latest_aws_sdk=True,
     policy=custom_resources.AwsCustomResourcePolicy.from_statements([
        iam.PolicyStatement(
            actions=["s3:PutInventoryConfiguration"],
            resources=[<bucket arn>],
        ),
    ]),
    on_delete={
        "service": "S3",
        "action": "deleteBucketInventoryConfiguration",
        "parameters": {
            "Bucket": <bucket name>,
            "Id": <id>,
        }
    }
)

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.118.0 (build a40f2ec)

Framework Version

No response

Node.js Version

v20.10.0

OS

Alpine 3.18

Language

Python

Language Version

3.19.0

Other information

No response

@rittneje rittneje added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Feb 8, 2024
@github-actions github-actions bot added the @aws-cdk/custom-resources Related to AWS CDK Custom Resources label Feb 8, 2024
@pahud
Copy link
Contributor

pahud commented Feb 8, 2024

Can you share the lambda logs?

We need to make sure if it just doesn't invoke the SDK call or it does and just times out. If it does and just times out, you probably will need to use the Provider Framework instead, which allows you to specify some timeout options.

@pahud pahud added p2 response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Feb 8, 2024
@rittneje
Copy link
Author

rittneje commented Feb 8, 2024

@pahud Here are the logs from CloudWatch.

@timestamp @message
2024-02-08 04:13:10.262 2024-02-08T04:13:10.262Z bdc84f65-7abf-490b-9b7d-1d7bf25e9e86 Task timed out after 120.11 seconds
2024-02-08 04:13:10.262 END RequestId: bdc84f65-7abf-490b-9b7d-1d7bf25e9e86
2024-02-08 04:13:10.262 REPORT RequestId: bdc84f65-7abf-490b-9b7d-1d7bf25e9e86 Duration: 120113.10 ms Billed Duration: 120000 ms Memory Size: 128 MB Max Memory Used: 128 MB
2024-02-08 04:11:10.403 2024-02-08T04:11:10.403Z bdc84f65-7abf-490b-9b7d-1d7bf25e9e86 INFO Installing latest AWS SDK v3: @aws-sdk/client-s3
2024-02-08 04:11:10.148 START RequestId: bdc84f65-7abf-490b-9b7d-1d7bf25e9e86 Version: $LATEST
2024-02-08 04:09:05.980 2024-02-08T04:09:05.980Z bdc84f65-7abf-490b-9b7d-1d7bf25e9e86 Task timed out after 120.29 seconds
2024-02-08 04:09:05.980 END RequestId: bdc84f65-7abf-490b-9b7d-1d7bf25e9e86
2024-02-08 04:09:05.980 REPORT RequestId: bdc84f65-7abf-490b-9b7d-1d7bf25e9e86 Duration: 120286.42 ms Billed Duration: 120000 ms Memory Size: 128 MB Max Memory Used: 128 MB
2024-02-08 04:07:05.899 2024-02-08T04:07:05.899Z bdc84f65-7abf-490b-9b7d-1d7bf25e9e86 INFO Installing latest AWS SDK v3: @aws-sdk/client-s3
2024-02-08 04:07:05.692 START RequestId: bdc84f65-7abf-490b-9b7d-1d7bf25e9e86 Version: $LATEST
2024-02-08 04:06:04.527 2024-02-08T04:06:04.526Z bdc84f65-7abf-490b-9b7d-1d7bf25e9e86 Task timed out after 122.10 seconds
2024-02-08 04:06:04.527 END RequestId: bdc84f65-7abf-490b-9b7d-1d7bf25e9e86
2024-02-08 04:06:04.527 REPORT RequestId: bdc84f65-7abf-490b-9b7d-1d7bf25e9e86 Duration: 122101.35 ms Billed Duration: 120000 ms Memory Size: 128 MB Max Memory Used: 128 MB Init Duration: 194.53 ms
2024-02-08 04:04:02.574 2024-02-08T04:04:02.574Z bdc84f65-7abf-490b-9b7d-1d7bf25e9e86 INFO Installing latest AWS SDK v3: @aws-sdk/client-s3
2024-02-08 04:04:02.423 START RequestId: bdc84f65-7abf-490b-9b7d-1d7bf25e9e86 Version: $LATEST

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Feb 8, 2024
@pahud
Copy link
Contributor

pahud commented Jun 3, 2024

Task timed out after 120.29 seconds

You may need to increase the lambda timeout or use the custom resource provider with the isComplete handler to check that status.

@rittneje
Copy link
Author

rittneje commented Jun 9, 2024

@pahud as I mentioned, it never even made the call.

@pahud pahud added p3 and removed p2 labels Jun 11, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
@aws-cdk/custom-resources Related to AWS CDK Custom Resources bug This issue is a bug. effort/medium Medium work item – several days of effort p3
Projects
None yet
Development

No branches or pull requests

2 participants