Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NIFI-2199 & NIFI-3112 - Handle propagation of stderr and allow ssh restart #1786

Closed
wants to merge 1 commit into from

Conversation

apiri
Copy link
Member

@apiri apiri commented May 11, 2017

NIFI-2199
NIFI-3112
Pipe stdout to /dev/null and allow stderr to propagate through.

This correction does not make NiFi fully LSB spec compliant but does solve the two issues presented in the listed tickets. This will allow stderr to propagate through and restart through SSH.

ssh can be tested by issuing a
ssh user@remote-host <path to nifi>/bin/nifi.sh restart
from a local machine to a remote host

3112 can be verified by changing a property to bootstrap causing it to be invalid and running the above. As listed in the prior discussion of 3112, making graceful.shutdown.seconds a negative number such as below:

graceful.shutdown.seconds=-20

Will cause an error to be triggered and the appropriate contents transmitted.

NIFI-3112
Pipe stdout to /dev/null and allow stderr to propagate through.
@michalklempa
Copy link
Contributor

Thank you Aldrin, as a part of NIFI-2199 I was thinking about the solution of changing the RunNifi java app to close the relevant streams. Would be cleaner and as I already introduced problems with stream redirection using bash, i would go for changing the Java part.

@gresockj
Copy link
Contributor

gresockj commented May 12, 2017

I tried this out, and it does appear to work when I run ssh user@remote-host "sudo service nifi restart". However, when I do the same with a salt command, it still hangs:
salt nifi cmd.run "sudo service nifi restart"

I believe salt uses the python "subprocess" call to invoke a command this way. Since this was working in 1.1.x, I feel like there should be a way to get it working again in 1.2.x.

Quick note: I changed 1>&- to 2>&- in order to also direct syserr to /dev/null, and this actually appears to work with salt. However, I don't know what adverse effects it may have. FWIW, I still saw the log statements in nifi-bootstrap.log during startup.

@apiri
Copy link
Member Author

apiri commented May 12, 2017

Hey @gresockj,

Don't have a lot of familiarity with python or Salt. Would you happen to have a sample salt script you would be able to share? I have a couple ideas on how to work with RunNiFi to make this happen.

@gresockj
Copy link
Contributor

Salt is easy to set up with this walkthrough. You can run salt-master and salt-minion on the same nifi box if you want in order to reproduce this behavior. Once you have it installed, you can run the command:

salt 'minionID' cmd.run "service nifi start"

@apiri
Copy link
Member Author

apiri commented May 12, 2017

thanks, will see what I can find

@kevdoran
Copy link
Contributor

@apiri I'd be happy to help dig into the salt use case if you would like

@apiri
Copy link
Member Author

apiri commented May 15, 2017

@kevdoran Sounds good! I propose we incorporate this PR for the time being to solve the prior two cases listed in the mentioned JIRAs and can open up a new JIRA to track issues with Salt and presumably other tools/scripts that may be Python driven. @gresockj let me know your thoughts. I will create a separate issue to track the Python side of the house.

@apiri
Copy link
Member Author

apiri commented May 15, 2017

@kevdoran
Copy link
Contributor

@apiri sounds good

@YolandaMDavis
Copy link
Contributor

@apiri will review

@YolandaMDavis
Copy link
Contributor

@apiri validated ssh command on remote host with with start/stop/restart. All worked as expected, with NiFi starting appropriately and the IO stream for ssh was closed. Also validated that bootstrap errors are appropriately routed to the output stream and displayed before stream is closed.

+1

will merge shortly. Thanks Aldrin!

@asfgit asfgit closed this in 58cf15a May 16, 2017
mattyb149 pushed a commit to mattyb149/nifi that referenced this pull request Nov 30, 2017
…agate through.

Signed-off-by: Yolanda M. Davis <ymdavis@apache.org>

This closes apache#1786
(cherry picked from commit 58cf15a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants