You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@inlong.apache.org by "aloyszhang (via GitHub)" <gi...@apache.org> on 2024/03/01 03:49:49 UTC

[I] [Bug][Manager] resource may leak due to BufferedReader not closed [inlong]

aloyszhang opened a new issue, #9760:
URL: https://github.com/apache/inlong/issues/9760

   ### What happened
   
   https://github.com/apache/inlong/blob/master/inlong-manager/manager-plugins/base/src/main/java/org/apache/inlong/manager/plugin/util/FlinkConfiguration.java#L98~L99
   
   ```java
   private FlinkConfig getFlinkConfigFromFile(String fileName) throws IOException {
           Properties properties = new Properties();
           BufferedReader bufferedReader = new BufferedReader(new FileReader(fileName));
           properties.load(bufferedReader);
           FlinkConfig flinkConfig = new FlinkConfig();
           flinkConfig.setPort(Integer.valueOf(properties.getProperty(PORT)));
           flinkConfig.setAddress(properties.getProperty(ADDRESS));
           flinkConfig.setParallelism(Integer.valueOf(properties.getProperty(PARALLELISM)));
           flinkConfig.setSavepointDirectory(properties.getProperty(SAVEPOINT_DIRECTORY));
           flinkConfig.setJobManagerPort(Integer.valueOf(properties.getProperty(JOB_MANAGER_PORT)));
           flinkConfig.setDrain(Boolean.parseBoolean(properties.getProperty(DRAIN)));
           flinkConfig.setAuditProxyHosts(properties.getProperty(METRICS_AUDIT_PROXY_HOSTS_KEY));
           flinkConfig.setVersion(properties.getProperty(FLINK_VERSION));
           return flinkConfig;
       }
   
   ```
   
   Some places are using a BufferedReader and do not close properly.
   
   
   ### What you expected to happen
   
   BufferReader should be closed after use
   
   ### How to reproduce
   
   See:
   
   https://github.com/apache/inlong/blob/master/inlong-manager/manager-plugins/base/src/main/java/org/apache/inlong/manager/plugin/util/FlinkConfiguration.java#L98~L99
   
   ```java
   private FlinkConfig getFlinkConfigFromFile(String fileName) throws IOException {
           Properties properties = new Properties();
           BufferedReader bufferedReader = new BufferedReader(new FileReader(fileName));
           properties.load(bufferedReader);
           FlinkConfig flinkConfig = new FlinkConfig();
           flinkConfig.setPort(Integer.valueOf(properties.getProperty(PORT)));
           flinkConfig.setAddress(properties.getProperty(ADDRESS));
           flinkConfig.setParallelism(Integer.valueOf(properties.getProperty(PARALLELISM)));
           flinkConfig.setSavepointDirectory(properties.getProperty(SAVEPOINT_DIRECTORY));
           flinkConfig.setJobManagerPort(Integer.valueOf(properties.getProperty(JOB_MANAGER_PORT)));
           flinkConfig.setDrain(Boolean.parseBoolean(properties.getProperty(DRAIN)));
           flinkConfig.setAuditProxyHosts(properties.getProperty(METRICS_AUDIT_PROXY_HOSTS_KEY));
           flinkConfig.setVersion(properties.getProperty(FLINK_VERSION));
           return flinkConfig;
       }
   
   ```
   
   ### Environment
   
   _No response_
   
   ### InLong version
   
   master
   
   ### InLong Component
   
   InLong Manager
   
   ### Are you willing to submit PR?
   
   - [X] Yes, I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
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: dev-unsubscribe@inlong.apache.org.apache.org

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


Re: [I] [Bug][Manager] resource may leak due to BufferedReader not closed [inlong]

Posted by "dockerzhang (via GitHub)" <gi...@apache.org>.
dockerzhang closed issue #9760: [Bug][Manager] resource may leak due to BufferedReader not closed
URL: https://github.com/apache/inlong/issues/9760


-- 
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: dev-unsubscribe@inlong.apache.org

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