JiangSOBD opened a new pull request, #11618:
URL: https://github.com/apache/rocketmq/pull/11618

   ### Which Issue(s) This PR Fixes
   
   - Refs #11602 (addresses items 1 and 2)
   
   ### Brief Description
   
   `ControllerStartup#createControllerManager` and
   `NamesrvStartup#parseCommandlineAndConfigFile` previously closed their
   configuration `InputStream`s only after all configuration loading and 
property
   mapping had completed.
   
   If `Properties#load` or `MixAll#properties2Object` threw an exception, the
   explicit `close()` call was skipped, potentially leaving the file descriptor
   open.
   
   This PR:
   
   - Uses try-with-resources for the configuration streams in both startup 
paths.
   - Ensures the streams are closed on both successful and exceptional paths.
   - Preserves the existing configuration loading, property mapping, logging, 
and
     `configStorePath` behavior.
   
   The scope of this PR is intentionally limited to the two startup 
configuration
   stream leaks described in #11602.
   
   ### How Did You Test This Change?
   
   - Built the affected `controller` and `namesrv` modules and their 
dependencies.
   - Ran the existing tests for the affected modules.
   - Verified that Checkstyle passes.
   - Confirmed that valid configuration files are still loaded with unchanged
     behavior.


-- 
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]

Reply via email to