You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nifi.apache.org by vcharmcaster <gi...@git.apache.org> on 2016/06/25 05:52:33 UTC
[GitHub] nifi pull request #584: closing InputStream after execution completes
GitHub user vcharmcaster opened a pull request:
https://github.com/apache/nifi/pull/584
closing InputStream after execution completes
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/vcharmcaster/nifi patch-1
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/nifi/pull/584.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 #584
----
commit fb299c0f93a01c6f7a81b0140d05d92ddf82d167
Author: Vaibhav kulkarni <vc...@users.noreply.github.com>
Date: 2016-06-25T05:52:26Z
closing InputStream after execution completes
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] nifi issue #584: closing InputStream after execution completes
Posted by joewitt <gi...@git.apache.org>.
Github user joewitt commented on the issue:
https://github.com/apache/nifi/pull/584
Hello
Is this PR associated with an Apache NiFi JIRA? If not can you please create one. Also, we'll want to update the commit message to reference that JIRA as well. You can see some of the key details that help make the PR process move along smoothly here: https://cwiki.apache.org/confluence/display/NIFI/Contributor+Guide
Thanks for contributing!
Joe
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] nifi pull request #584: closing InputStream after execution completes
Posted by olegz <gi...@git.apache.org>.
Github user olegz commented on a diff in the pull request:
https://github.com/apache/nifi/pull/584#discussion_r101118510
--- Diff: nifi-external/nifi-spark-receiver/src/main/java/org/apache/nifi/spark/NiFiReceiver.java ---
@@ -162,17 +162,19 @@ public void run() {
}
final List<NiFiDataPacket> dataPackets = new ArrayList<>();
+ InputStream inStream =null;
do {
// Read the data into a byte array and wrap it along with the attributes
// into a NiFiDataPacket.
- final InputStream inStream = dataPacket.getData();
+ inStream = dataPacket.getData();
final byte[] data = new byte[(int) dataPacket.getSize()];
StreamUtils.fillBuffer(inStream, data);
final Map<String, String> attributes = dataPacket.getAttributes();
final NiFiDataPacket NiFiDataPacket = new StandardNiFiDataPacket(data, attributes);
dataPackets.add(NiFiDataPacket);
dataPacket = transaction.receive();
+ inStream.close();
--- End diff --
While generally it is indeed necessary to close the resources to avoid unnecessary memory leaks, this is not the right place to do that since NiFiReceiver is not the creator/owner of the stream and if another handle exist for such stream it could lead to unexpected results. We should probably investigate where this stream is created and ensure that it is closed there.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] nifi issue #584: closing InputStream after execution completes
Posted by olegz <gi...@git.apache.org>.
Github user olegz commented on the issue:
https://github.com/apache/nifi/pull/584
@vcharmcaster Since it appears this is your initial participation with Apache NiFi I'd like to welcome you and thank you for your contribution and participation.
Aside from making things run smoothly (as @joewitt pointed out), the core reason for having JIRA corresponding to every PR is the traceability factor where users and developers like you can clearly see what issues are being addressed. So please file a JIRA - https://issues.apache.org/jira/browse/NIFI and update your PR and commit message. And don't hesitate to ask for help with this process if need to.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] nifi issue #584: closing InputStream after execution completes
Posted by trixpan <gi...@git.apache.org>.
Github user trixpan commented on the issue:
https://github.com/apache/nifi/pull/584
@vcharmcaster - there has been a while since you opened this PR and @olegz question still an answered. Is this PR still needed?
Otherwise, would you mind closing it?
Kind regards
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] nifi issue #584: closing InputStream after execution completes
Posted by vcharmcaster <gi...@git.apache.org>.
Github user vcharmcaster commented on the issue:
https://github.com/apache/nifi/pull/584
HI Joe,
I am newbie, made some changes which will improve performance. There is no PR associated with NiFi, Let me know how to create one?
usually it is good practice to close input stream and reuse variable instead of creating one each time.
-
VK
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] nifi issue #584: closing InputStream after execution completes
Posted by vcharmcaster <gi...@git.apache.org>.
Github user vcharmcaster commented on the issue:
https://github.com/apache/nifi/pull/584
Will close tomorrow morning. My bad forgot to close PR
-
VK
On Mon, 1 May 2017 at 4:58 PM, Andre F de Miranda <no...@github.com>
wrote:
> @vcharmcaster <https://github.com/vcharmcaster> - there has been a while
> since you opened this PR and @olegz <https://github.com/olegz> question
> still an answered. Is this PR still needed?
>
> Otherwise, would you mind closing it?
>
> Kind regards
>
> \u2014
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://github.com/apache/nifi/pull/584#issuecomment-298321051>, or mute
> the thread
> <https://github.com/notifications/unsubscribe-auth/AF1rFwYyvIfT5qUtKvbAZqZddI9FZQjKks5r1cG_gaJpZM4I-RrM>
> .
>
--
[image: --]
Vaibhav Khamgonkar
[image: http://]about.me/vaibhav_khamgonkar
<https://about.me/vaibhav_khamgonkar>
Note: This e-mail message and attachments may contain confidential
information. If you have received this message in error, please immediately
notify the sender and delete this e-mail message.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] nifi pull request #584: closing InputStream after execution completes
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/nifi/pull/584
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---