You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "adoroszlai (via GitHub)" <gi...@apache.org> on 2024/01/25 19:27:50 UTC

[PR] HDDS-10204. TypedTable.putWithBatch may leak if conversion of value throws [ozone]

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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-10204. TypedTable.putWithBatch may leak if conversion of value throws [ozone]

Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai merged PR #6097:
URL: https://github.com/apache/ozone/pull/6097


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-10204. TypedTable.putWithBatch may leak if conversion of value throws [ozone]

Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on PR #6097:
URL: https://github.com/apache/ozone/pull/6097#issuecomment-1912017641

   Thanks @szetszwo for the review.


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org