liudezhi2098 opened a new pull request #6745: fix_msgMetadata_not_recycle URL: https://github.com/apache/pulsar/pull/6745 **Motivation** fix when producing encrypted messages for inspection, MessageMetadata objects are not released after they are created. #6744 ```javascript if (topic.isEncryptionRequired()) { headersAndPayload.markReaderIndex(); MessageMetadata msgMetadata = Commands.parseMessageMetadata(headersAndPayload); headersAndPayload.resetReaderIndex(); // Check whether the message is encrypted or not if (msgMetadata.getEncryptionKeysCount() < 1) { log.warn("[{}] Messages must be encrypted", getTopic().getName()); cnx.ctx().channel().eventLoop().execute(() -> { cnx.ctx().writeAndFlush(Commands.newSendError(producerId, sequenceId, ServerError.MetadataError, "Messages must be encrypted")); cnx.completedSendOperation(isNonPersistentTopic, headersAndPayload.readableBytes()); }); return; } } } ``` MessageMetadata was not recycled **Changes** Replace old value with new value ```javascript if (topic.isEncryptionRequired()) { headersAndPayload.markReaderIndex(); MessageMetadata msgMetadata = Commands.parseMessageMetadata(headersAndPayload); headersAndPayload.resetReaderIndex(); int encryptionKeysCount = msgMetadata.getEncryptionKeysCount(); metadata.recycle(); // Check whether the message is encrypted or not if (encryptionKeysCount < 1) { log.warn("[{}] Messages must be encrypted", getTopic().getName()); cnx.ctx().channel().eventLoop().execute(() -> { cnx.ctx().writeAndFlush(Commands.newSendError(producerId, sequenceId, ServerError.MetadataError, "Messages must be encrypted")); cnx.completedSendOperation(isNonPersistentTopic, headersAndPayload.readableBytes()); }); return; } } ```
---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
