You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@streampark.apache.org by "jianjun159 (via GitHub)" <gi...@apache.org> on 2024/04/15 10:24:09 UTC
[PR] [ISSUES-3667] KubernetesClusterDescriptor not closed after use, cause the file handle resource leaks [incubator-streampark]
jianjun159 opened a new pull request, #3668:
URL: https://github.com/apache/incubator-streampark/pull/3668
<!--
Thank you for contributing to StreamPark! Please make sure that your code changes
are covered with tests. And in case of new features or big changes
remember to adjust the documentation.
## Contribution Checklist
- If this is your first time, please read our contributor guidelines: [Submit Code](https://streampark.apache.org/community/submit_guide/submit_code).
- Make sure that the pull request corresponds to a [GITHUB issue](https://github.com/apache/incubator-streampark/issues).
- Name the pull request in the form "[Feature] Title of the pull request", where *Feature* can be replaced by `Hotfix`, `Bug`, etc.
- Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
- If the PR is unfinished, add `[WIP]` in your PR title, e.g., `[WIP][Feature] Title of the pull request`.
-->
## What changes were proposed in this pull request
Issue Number: close #3667
<!--(For example: This pull request proposed to add checkstyle plugin).-->
## Brief change log
<!--*(for example:)*
- *Add maven-checkstyle-plugin to root pom.xml*
-->
## Verifying this change
<!--*(Please pick either of the following options)*-->
This change is a trivial rework / code cleanup without any test coverage.
*(or)*
This change is already covered by existing tests, such as *(please describe tests)*.
*(or)*
This change added tests and can be verified as follows:
<!--*(example:)*
- *Added integration tests for end-to-end.*
- *Added *Test to verify the change.*
- *Manually verified the change by testing locally.* -->
## Does this pull request potentially affect one of the following parts
- Dependencies (does it add or upgrade a dependency): (yes / no)
--
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: issues-unsubscribe@streampark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [ISSUES-3667] KubernetesClusterDescriptor not closed after use, cause the file handle resource leaks [incubator-streampark]
Posted by "caicancai (via GitHub)" <gi...@apache.org>.
caicancai commented on code in PR #3668:
URL: https://github.com/apache/incubator-streampark/pull/3668#discussion_r1566599866
##########
streampark-flink/streampark-flink-kubernetes/src/main/scala/org/apache/streampark/flink/kubernetes/KubernetesRetriever.scala:
##########
@@ -89,15 +89,19 @@ object KubernetesRetriever extends Logger {
val clusterProvider: KubernetesClusterDescriptor =
clientFactory.createClusterDescriptor(flinkConfig).asInstanceOf[KubernetesClusterDescriptor]
- Try {
- clusterProvider
- .retrieve(flinkConfig.getString(KubernetesConfigOptions.CLUSTER_ID))
- .getClusterClient
- } match {
- case Success(v) => Some(v)
- case Failure(e) =>
- logError(s"Get flinkClient error, the error is: $e")
- None
+ try {
Review Comment:
+1
--
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: issues-unsubscribe@streampark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [ISSUES-3667] KubernetesClusterDescriptor not closed after use, cause the file handle resource leaks [incubator-streampark]
Posted by "wolfboys (via GitHub)" <gi...@apache.org>.
wolfboys commented on code in PR #3668:
URL: https://github.com/apache/incubator-streampark/pull/3668#discussion_r1565641719
##########
streampark-flink/streampark-flink-kubernetes/src/main/scala/org/apache/streampark/flink/kubernetes/KubernetesRetriever.scala:
##########
@@ -89,15 +89,19 @@ object KubernetesRetriever extends Logger {
val clusterProvider: KubernetesClusterDescriptor =
clientFactory.createClusterDescriptor(flinkConfig).asInstanceOf[KubernetesClusterDescriptor]
- Try {
- clusterProvider
- .retrieve(flinkConfig.getString(KubernetesConfigOptions.CLUSTER_ID))
- .getClusterClient
- } match {
- case Success(v) => Some(v)
- case Failure(e) =>
- logError(s"Get flinkClient error, the error is: $e")
- None
+ try {
Review Comment:
Can you test the improved code below? If it can pass the test, it is recommended to use the following code
```scala
// retrieve flink cluster client
clusterClientServiceLoader
.getClusterClientFactory(flinkConfig)
.createClusterDescriptor(flinkConfig)
.asInstanceOf[KubernetesClusterDescriptor]
.autoClose {
clusterProvider =>
Try {
clusterProvider
.retrieve(flinkConfig.getString(KubernetesConfigOptions.CLUSTER_ID))
.getClusterClient
} match {
case Success(v) => Some(v)
case Failure(e) =>
logError(s"Get flinkClient error, the error is: $e")
None
}
}
```
--
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: issues-unsubscribe@streampark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [ISSUES-3667] KubernetesClusterDescriptor not closed after use, cause the file handle resource leaks [incubator-streampark]
Posted by "caicancai (via GitHub)" <gi...@apache.org>.
caicancai merged PR #3668:
URL: https://github.com/apache/incubator-streampark/pull/3668
--
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: issues-unsubscribe@streampark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org