You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by yanghua <gi...@git.apache.org> on 2018/06/14 14:20:27 UTC
[GitHub] flink pull request #6166: [FLINK-9580] Potentially unclosed ByteBufInputStre...
GitHub user yanghua opened a pull request:
https://github.com/apache/flink/pull/6166
[FLINK-9580] Potentially unclosed ByteBufInputStream in RestClient##readRawResponse
## What is the purpose of the change
*This pull request fixed potentially stream connection leak*
## Brief change log
- *Add finally block to close specific input stream*
## Verifying this change
This change is a trivial rework / code cleanup without any test coverage.
## Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): (yes / **no**)
- The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (yes / **no**)
- The serializers: (yes / **no** / don't know)
- The runtime per-record code paths (performance sensitive): (yes / **no** / don't know)
- Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Yarn/Mesos, ZooKeeper: (yes / **no** / don't know)
- The S3 file system connector: (yes / **no** / don't know)
## Documentation
- Does this pull request introduce a new feature? (yes / **no**)
- If yes, how is the feature documented? (not applicable / docs / JavaDocs / **not documented**)
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/yanghua/flink FLINK-9580
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/flink/pull/6166.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #6166
----
commit f5590d2e9053282a19c8fe808cd368d40ef54787
Author: yanghua <ya...@...>
Date: 2018-06-14T08:16:20Z
[FLINK-9580] Potentially unclosed ByteBufInputStream in RestClient#readRawResponse
----
---
[GitHub] flink issue #6166: [FLINK-9580] Potentially unclosed ByteBufInputStream in R...
Posted by zentol <gi...@git.apache.org>.
Github user zentol commented on the issue:
https://github.com/apache/flink/pull/6166
merging.
---
[GitHub] flink pull request #6166: [FLINK-9580] Potentially unclosed ByteBufInputStre...
Posted by pnowojski <gi...@git.apache.org>.
Github user pnowojski commented on a diff in the pull request:
https://github.com/apache/flink/pull/6166#discussion_r195774420
--- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/rest/RestClient.java ---
@@ -292,30 +292,49 @@ private void readRawResponse(FullHttpResponse msg) {
ByteBuf content = msg.content();
JsonNode rawResponse;
+ InputStream in = null;
try {
- InputStream in = new ByteBufInputStream(content);
+ in = new ByteBufInputStream(content);
rawResponse = objectMapper.readTree(in);
LOG.debug("Received response {}.", rawResponse);
} catch (JsonParseException je) {
LOG.error("Response was not valid JSON.", je);
// let's see if it was a plain-text message instead
content.readerIndex(0);
+ ByteBufInputStream inputStream = null;
try {
- ByteBufInputStream in = new ByteBufInputStream(content);
+ inputStream = new ByteBufInputStream(content);
--- End diff --
ditto?
---
[GitHub] flink pull request #6166: [FLINK-9580] Potentially unclosed ByteBufInputStre...
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/flink/pull/6166
---
[GitHub] flink pull request #6166: [FLINK-9580] Potentially unclosed ByteBufInputStre...
Posted by pnowojski <gi...@git.apache.org>.
Github user pnowojski commented on a diff in the pull request:
https://github.com/apache/flink/pull/6166#discussion_r195774052
--- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/rest/RestClient.java ---
@@ -292,30 +292,49 @@ private void readRawResponse(FullHttpResponse msg) {
ByteBuf content = msg.content();
JsonNode rawResponse;
+ InputStream in = null;
try {
- InputStream in = new ByteBufInputStream(content);
+ in = new ByteBufInputStream(content);
--- End diff --
couldn't you put this `InputStream` inside try with resource?
```
try (InputStream in = new ByteBufInputStream(content)) {
...
}
```
---
[GitHub] flink issue #6166: [FLINK-9580] Potentially unclosed ByteBufInputStream in R...
Posted by yanghua <gi...@git.apache.org>.
Github user yanghua commented on the issue:
https://github.com/apache/flink/pull/6166
cc @zentol @pnowojski
---
[GitHub] flink issue #6166: [FLINK-9580] Potentially unclosed ByteBufInputStream in R...
Posted by yanghua <gi...@git.apache.org>.
Github user yanghua commented on the issue:
https://github.com/apache/flink/pull/6166
cc @pnowojski
---