[
https://issues.apache.org/jira/browse/NIFI-3112?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15708127#comment-15708127
]
Michal Klempa commented on NIFI-3112:
-------------------------------------
Hi [~JPercivall],
well, it is always the workaround. The design of Bootstrap is ridiculous and
that is the key problem, which was only workarounded in NIFI-2199.
When a process is starting (Bootstrap), it can and should do some logging and
if it is a background process, it usually put itself to background, cutting of
the stdin,out,err.
See this guide how C/C++ guys deal with it:
http://www.enderunix.org/documents/eng/daemon.php
The problem is, that Bootstrap (which creates NiFi as a child), is in fact a
daemon process in Unix, but it is not coded in that way. I have workarounded
the issues with not-detaching of Bootstrap by redirecting the IO in nifi.sh.
You are proposing redirection using shell when running through SSH (You did
know that by default, SSH does not use shell to execute a process remotely,
didn't you).
This is also a workaround. So ok, lets do it this way, but lets refocus on
solving the problem : Bootstrap is not a proper Unix daemon process.
The Bootstrap should log something and after a while, when it is sure the NiFi
is running, it should close the streams and detach. This is the usual way it
goes. Users commonly workaroung this for Java tools using nohup and redirection
in init scripts. But admins always know, where they can send logging output. We
as developers of upstream have no chance in catching all various versions of
Unix and 'where to send the logging output'.
We can:
1. either solve stdin/out/err closing and daemonization in Java
2. start providing Debian/RedHat packages for NiFi which would create the init
script in a system-usual way, each distro has its habits and we can take
advantage of this and log the Bootstrap output to location, where system admins
are expecting it to be, depending on distro
Providing a 'unified' init script for all Unixes will probably become
unfeasible either...
For now, I accept your proposal on fixing this issue. I was unaware that I will
cause these problems. Sorry for that. But lets discuss what we can do, to make
Bootstrap behave properly.
For example
https://github.com/apache/commons-daemon
but this seems really complex approach.
Maybe we can just try to close the streams:
http://barelyenough.org/blog/2005/03/java-daemon/
And situation gets worse with systemd (do the nifi have systemd installation?).
I will give a 'stream close' approach a try and give you info on how it went.
> When running "nifi.sh start" errors that occur in the bootstrap are routed
> to dev/null
> ---------------------------------------------------------------------------------------
>
> Key: NIFI-3112
> URL: https://issues.apache.org/jira/browse/NIFI-3112
> Project: Apache NiFi
> Issue Type: Bug
> Reporter: Joseph Percivall
> Assignee: Andre
> Priority: Critical
> Fix For: 1.2.0
>
>
> The commit added in this PR[1] makes it so any errors that occur in the
> bootstrap during a "start" command will get routed to dev/null and it will
> silently fail. Nothing is logged to the bootstrap log either. If you do the
> "run" command it will work as expected and show the error.
> [1] https://github.com/apache/nifi/pull/1092
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)