You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by nsanglar <gi...@git.apache.org> on 2018/03/29 06:02:54 UTC
[GitHub] nifi pull request #2594: NIFI-5024 Resolves deadlock in ExecuteStreamCommand...
GitHub user nsanglar opened a pull request:
https://github.com/apache/nifi/pull/2594
NIFI-5024 Resolves deadlock in ExecuteStreamCommand processor
Thank you for submitting a contribution to Apache NiFi.
In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:
### For all changes:
- [x] Is there a JIRA ticket associated with this PR? Is it referenced
in the commit message?
- [x] Does your PR title start with NIFI-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
- [x] Has your PR been rebased against the latest commit within the target branch (typically master)?
- [x] Is your initial contribution a single, squashed commit?
### For code changes:
- [x] Have you ensured that the full suite of tests is executed via mvn -Pcontrib-check clean install at the root nifi folder?
- [x] Have you written or updated unit tests to verify your changes?
- [x] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)?
- [ ] If applicable, have you updated the LICENSE file, including the main LICENSE file under nifi-assembly?
- [ ] If applicable, have you updated the NOTICE file, including the main NOTICE file found under nifi-assembly?
- [ ] If adding new Properties, have you added .displayName in addition to .name (programmatic access) for each of the new properties?
### For documentation related changes:
- [ ] Have you ensured that format looks appropriate for the output in which it is rendered?
### Note:
Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/Sqooba/nifi nifi-5024
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/nifi/pull/2594.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 #2594
----
commit cd7bc120e3d82a0aa392b84717e54e2f76ae7ae2
Author: Nicolas Sanglard <ni...@...>
Date: 2018-03-29T05:59:03Z
NIFI-5024 Resolves deadlock in ExecuteStreamCommand processor
----
---
[GitHub] nifi issue #2594: NIFI-5024 Resolves deadlock in ExecuteStreamCommand proces...
Posted by nsanglar <gi...@git.apache.org>.
Github user nsanglar commented on the issue:
https://github.com/apache/nifi/pull/2594
@MikeThomsen It's strange because I removed this 1mb.txt file and the corresponding exclusion in the previous commits. Did you added something before merging? I can see that the build is failing on master now
---
[GitHub] nifi issue #2594: NIFI-5024 Resolves deadlock in ExecuteStreamCommand proces...
Posted by nsanglar <gi...@git.apache.org>.
Github user nsanglar commented on the issue:
https://github.com/apache/nifi/pull/2594
@MikeThomsen The AppVeyor build failed because:
```Build execution time has reached the maximum allowed time for your plan (90 minutes).```
Is it a common issue?
---
[GitHub] nifi issue #2594: NIFI-5024 Resolves deadlock in ExecuteStreamCommand proces...
Posted by MikeThomsen <gi...@git.apache.org>.
Github user MikeThomsen commented on the issue:
https://github.com/apache/nifi/pull/2594
Don't worry about it, it's just a checkstyle issue. I can fix with a simple commit.
---
[GitHub] nifi pull request #2594: NIFI-5024 Resolves deadlock in ExecuteStreamCommand...
Posted by nsanglar <gi...@git.apache.org>.
Github user nsanglar commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2594#discussion_r187841438
--- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ExecuteStreamCommand.java ---
@@ -351,6 +350,16 @@ public void onTrigger(ProcessContext context, final ProcessSession session) thro
builder.directory(dir);
builder.redirectInput(Redirect.PIPE);
builder.redirectOutput(Redirect.PIPE);
+ final File errorOut;
+ try {
+ errorOut = File.createTempFile("out", null);
+ errorOut.deleteOnExit();
--- End diff --
Good point, I will do that
---
[GitHub] nifi pull request #2594: NIFI-5024 Resolves deadlock in ExecuteStreamCommand...
Posted by nsanglar <gi...@git.apache.org>.
Github user nsanglar commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2594#discussion_r187841413
--- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ExecuteStreamCommand.java ---
@@ -382,10 +389,10 @@ public void onTrigger(ProcessContext context, final ProcessSession session) thro
Map<String, String> attributes = new HashMap<>();
final StringBuilder strBldr = new StringBuilder();
- try {
- String line;
- while ((line = bufferedReader.readLine()) != null) {
- strBldr.append(line).append("\n");
+ try (final InputStream is = new FileInputStream(errorOut)) {
--- End diff --
Strange, the link is not working for me either anymore. There are some pointers on this stackoverflow thread:
https://stackoverflow.com/questions/16983372/why-does-process-hang-if-the-parent-does-not-consume-stdout-stderr-in-java
The difference is that by writing to a file, you bypass the OS pipe for stderr, and therefore it does not block.
By the way if you execute `TestExecuteStreamCommand` with the old code, you will be able to reproduce the deadlock even with unit tests.
---
[GitHub] nifi issue #2594: NIFI-5024 Resolves deadlock in ExecuteStreamCommand proces...
Posted by MikeThomsen <gi...@git.apache.org>.
Github user MikeThomsen commented on the issue:
https://github.com/apache/nifi/pull/2594
Also, that exclude you removed is why it broke, but I forgot to do contrib-check apparently...
---
[GitHub] nifi issue #2594: NIFI-5024 Resolves deadlock in ExecuteStreamCommand proces...
Posted by MikeThomsen <gi...@git.apache.org>.
Github user MikeThomsen commented on the issue:
https://github.com/apache/nifi/pull/2594
@nsanglar I think I must have missed your notifications. Sorry about that. WRT appveyor, don't worry about that since Travis passed at least one build (sometimes it gets cranky; 1 full pass is enough to pass that). I'll try to find some time to go over it tonight or tomorrow morning.
---
[GitHub] nifi issue #2594: NIFI-5024 Resolves deadlock in ExecuteStreamCommand proces...
Posted by nsanglar <gi...@git.apache.org>.
Github user nsanglar commented on the issue:
https://github.com/apache/nifi/pull/2594
@MikeThomsen Did you have a chance to go through the changes?
---
[GitHub] nifi pull request #2594: NIFI-5024 Resolves deadlock in ExecuteStreamCommand...
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/nifi/pull/2594
---
[GitHub] nifi pull request #2594: NIFI-5024 Resolves deadlock in ExecuteStreamCommand...
Posted by MikeThomsen <gi...@git.apache.org>.
Github user MikeThomsen commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2594#discussion_r187743134
--- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ExecuteStreamCommand.java ---
@@ -382,10 +389,10 @@ public void onTrigger(ProcessContext context, final ProcessSession session) thro
Map<String, String> attributes = new HashMap<>();
final StringBuilder strBldr = new StringBuilder();
- try {
- String line;
- while ((line = bufferedReader.readLine()) != null) {
- strBldr.append(line).append("\n");
+ try (final InputStream is = new FileInputStream(errorOut)) {
--- End diff --
The java-monitor.com link wouldn't load for me, so I couldn't see your reference. So is this problem here with the BufferedReader? I'm not entirely sure I follow the change here because either way you're pulling data from stderr. This case just redirects it and you're reading it from a file.
---
[GitHub] nifi pull request #2594: NIFI-5024 Resolves deadlock in ExecuteStreamCommand...
Posted by MikeThomsen <gi...@git.apache.org>.
Github user MikeThomsen commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2594#discussion_r187742376
--- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ExecuteStreamCommand.java ---
@@ -351,6 +350,16 @@ public void onTrigger(ProcessContext context, final ProcessSession session) thro
builder.directory(dir);
builder.redirectInput(Redirect.PIPE);
builder.redirectOutput(Redirect.PIPE);
+ final File errorOut;
+ try {
+ errorOut = File.createTempFile("out", null);
+ errorOut.deleteOnExit();
--- End diff --
I would like to see this deleted after every iteration of the processor because it could a very long time brefore deleteOnExit gets executed.
---