xcx1r3 opened a new issue, #9447: URL: https://github.com/apache/rocketmq/issues/9447
### Before Creating the Enhancement Request - [x] I have confirmed that this should be classified as an enhancement rather than a bug/feature. ### Summary # leak 1 `org.apache.rocketmq.container.BrokerContainerStartup#loadConfig` InputStream in.  If an exception occurs during `properties.load(in)`, the `in.close()` line will be skipped, and the `InputStream` will not be closed. # leak 2 `org.apache.rocketmq.test.schema.SchemaTools#load` BufferedReader br.  The line `br.close();` is intended to release this resource. However, it might be skipped if an exception occurs within the while loop. # leak 3 `org.apache.rocketmq.remoting.protocol.body.RegisterBrokerBody#decode` InflaterInputStream inflaterInputStream inflaterInputStream is never closed. # leak 4 `org.apache.rocketmq.remoting.protocol.body.RegisterBrokerBody#encode` DeflaterOutputStream outputStream outputStream is never closed. # leak 5 `org.apache.rocketmq.test.util.DuplicateMessageInfo#checkDuplicatedMessageInfo` OutputStream out  The code attempts to close the stream with out.close();. However, if an exception occurs after the FileOutputStream is successfully opened but before out.close() is executed, the close() call will be skipped. # leak 6 `org.apache.rocketmq.broker.BrokerStartup#loadConfig` InputStream in  same as leak 1 ### Motivation This enhancement effort revealed potential resource leaks. Recurrent leakage would cause an aggregation of unreleased resources, ultimately leading to the depletion of system resources available to the application. ### Describe the Solution You'd Like `try-with-resources` solutions effectively address the resource leak. ### Describe Alternatives You've Considered Proposed solution is widely recognized as the most effective and appropriate method. ### Additional Context _No response_ -- 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]
