Skip to content

Commit

Permalink
HDDS-11574. Ozone client leak in TestS3SDKV1 (apache#7308)
Browse files Browse the repository at this point in the history
  • Loading branch information
adoroszlai authored Oct 14, 2024
1 parent c044b79 commit c579d06
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ public static HddsProtos.UUID toProtobuf(UUID uuid) {
*/
public static void reportLeak(Class<?> clazz, String stackTrace, Logger log) {
String warning = String.format("%s is not closed properly", clazz.getSimpleName());
if (stackTrace != null && LOG.isDebugEnabled()) {
if (stackTrace != null && log.isDebugEnabled()) {
String debugMessage = String.format("%nStackTrace for unclosed instance: %s",
stackTrace);
warning = warning.concat(debugMessage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -430,17 +430,18 @@ public void testGetObjectWithoutETag() throws Exception {
byte[] valueBytes = value.getBytes(StandardCharsets.UTF_8);

OzoneConfiguration conf = cluster.getConf();
OzoneClient ozoneClient = OzoneClientFactory.getRpcClient(conf);
ObjectStore store = ozoneClient.getObjectStore();
try (OzoneClient ozoneClient = OzoneClientFactory.getRpcClient(conf)) {
ObjectStore store = ozoneClient.getObjectStore();

OzoneVolume volume = store.getS3Volume();
OzoneBucket bucket = volume.getBucket(bucketName);
OzoneVolume volume = store.getS3Volume();
OzoneBucket bucket = volume.getBucket(bucketName);

try (OzoneOutputStream out = bucket.createKey(keyName,
valueBytes.length,
ReplicationConfig.fromTypeAndFactor(ReplicationType.RATIS, ReplicationFactor.ONE),
Collections.emptyMap())) {
out.write(valueBytes);
try (OzoneOutputStream out = bucket.createKey(keyName,
valueBytes.length,
ReplicationConfig.fromTypeAndFactor(ReplicationType.RATIS, ReplicationFactor.ONE),
Collections.emptyMap())) {
out.write(valueBytes);
}
}

S3Object s3Object = s3Client.getObject(bucketName, keyName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ log4j.logger.org.apache.hadoop.security.ShellBasedUnixGroupsMapping=ERROR
log4j.logger.org.apache.hadoop.util.NativeCodeLoader=ERROR
log4j.logger.org.apache.hadoop.hdds.utils.db.managed=TRACE
log4j.logger.org.apache.hadoop.hdds.utils.db.CodecBuffer=DEBUG
log4j.logger.org.apache.hadoop.ozone.client.OzoneClientFactory=DEBUG

0 comments on commit c579d06

Please sign in to comment.