adoroszlai opened a new pull request, #6097:
URL: https://github.com/apache/ozone/pull/6097
## What changes were proposed in this pull request?
`TypedTable.putWithBatch` defers closing `CodecBuffer` until the batch is
committed. If value conversion (or `putWithBatch` itself) throws, the buffers
are not added to the batch, so they need to be released eagerly.
Example value conversion error:
```
NullPointerException
at
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos$S3Secret$Builder.setAwsSecret(OzoneManagerProtocolProtos.java)
at
org.apache.hadoop.ozone.om.helpers.S3SecretValue.getProtobuf(S3SecretValue.java:100)
at
org.apache.hadoop.hdds.utils.db.DelegatedCodec.toCodecBuffer(DelegatedCodec.java:85)
at
org.apache.hadoop.hdds.utils.db.Codec.toDirectCodecBuffer(Codec.java:73)
at
org.apache.hadoop.hdds.utils.db.TypedTable.putWithBatch(TypedTable.java:171)
at
org.apache.hadoop.ozone.om.OmMetadataManagerImpl$1.addWithBatch(OmMetadataManagerImpl.java:1949)
at
org.apache.hadoop.ozone.om.response.s3.security.OMSetSecretResponse.addToDBBatch(OMSetSecretResponse.java:80)
```
Key leak:
```
2024-01-24 09:49:09,454 [Finalizer] WARN db.CodecBuffer
(CodecBuffer.java:detectLeaks(278)) - LEAK 1: [0<=18<=54: 74 65 73 74 55 73 65
72 31 61 ...], refCnt=1, capacity=54 allocation:
org.apache.hadoop.hdds.utils.db.CodecBuffer.<init>(CodecBuffer.java:53)
...
org.apache.hadoop.hdds.utils.db.StringCodecBase.toCodecBuffer(StringCodecBase.java:174)
org.apache.hadoop.hdds.utils.db.StringCodec.toCodecBuffer(StringCodec.java:28)
org.apache.hadoop.hdds.utils.db.StringCodecBase.toCodecBuffer(StringCodecBase.java:42)
org.apache.hadoop.hdds.utils.db.Codec.toDirectCodecBuffer(Codec.java:73)
org.apache.hadoop.hdds.utils.db.TypedTable.putWithBatch(TypedTable.java:170)
org.apache.hadoop.ozone.om.OmMetadataManagerImpl$1.addWithBatch(OmMetadataManagerImpl.java:1949)
org.apache.hadoop.ozone.om.response.s3.security.OMSetSecretResponse.addToDBBatch(OMSetSecretResponse.java:80)
```
The root cause of this specific conversion problem was fixed in HDDS-10200.
This PR is only for the `CodecBuffer` leak.
https://issues.apache.org/jira/browse/HDDS-10204
## How was this patch tested?
`TestMultiTenantVolume` passed 10x100 (without the fix from HDDS-10200):
https://github.com/adoroszlai/ozone/actions/runs/7658045401
CI:
https://github.com/adoroszlai/ozone/actions/runs/7657732895
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]