Recipe Name:
Not releasing DynamoDbClient
Description:
Call the close() method to release the DynamoDbClient
Level:
error
Language:
- java
Tags:
- framework specific
- AWS
- quality
Documentation
By not releasing the DynamoDbClient
you could run the risk of leaking resources. If an attacker exploits a memory leak, this could possible lead to Denial of Service. AWS recommends to shut down the client to release the resources and render it unusable.
public void method() { DynamoDbClient ddb = DynamoDbClient.create(); // ... };After
public void method() { DynamoDbClient ddb = DynamoDbClient.create(); // ... ddb.close(); }Resources
Recipe
id: scw:aws:dynamodbclient-close version: 10 metadata: name: Not releasing DynamoDbClient shortDescription: Call the close() method to release the DynamoDbClient level: error language: java enabled: true descriptionFile: descriptions/ReleaseDynamoDbClientClose.html tags: framework specific;AWS;quality search: methodcall: not: followedBy: methodcall: name: close declaration: type: software.amazon.awssdk.services.dynamodb.DynamoDbClient name: create declaration: type: software.amazon.awssdk.services.dynamodb.DynamoDbClient availableFixes: - name: Call the close method actions: - addMethodCall: name: close position: end-of-life