zjt0926 opened a new issue, #11608: URL: https://github.com/apache/rocketmq/issues/11608
FileWatchService (srvutil) only registers watch targets that already exist when the service is constructed. run0() only re-hashes the paths kept in currentHash, so a configured path that does not exist at startup is never watched. If such a file is created afterwards - for example a TLS certificate that is provisioned or mounted after the process starts - Listener.onChanged is never invoked. This breaks the dynamic TLS certificate reload in the broker, the NameServer and the proxy, because FileWatchService is the component that triggers the SSL context reload. md5Digest() already returns an empty hash for missing files and reuses the previous hash for deleted files, so the exists() filter in the constructor is not needed and only prevents later-created files from being tracked. ### Steps to reproduce 1. Construct FileWatchService with a path that does not exist yet (the same situation as starting a broker/NameServer/proxy with TLS enabled before its certificate file is provisioned). 2. Start the service. 3. Create the file and write content. ### Expected The listener is notified when the file appears. ### Actual The listener is never called, so the TLS context is never reloaded. A regression test is included in the pull request. -- 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]
