daisy/pipeline-assembly

Use exec in bin/pipeline2

Closed this issue · 8 comments

It used to be exec but was changed to eval to "cope with unescaped env variables", possibly in response to a bug report from John Brugge.

However, the nice thing about exec is that it replaces the shell without creating a new process. Without exec a child process is started. This causes trouble for the Debian package where we daemonised bin/pipeline2 using start-stop-daemon. The problem is that stopping the daemon doesn't seem to stop the child process.

Another solution could be to have a trap in the bash script that takes care of killing the subprocesses.

Could exec eval or eval exec work?

I'm not against using exec, but we need to ensure we won't be hit again by the issue reported by @jbrugge. @bertfrees do you want to investigate ?

@bertfrees also, note that using eval may have been needed to work around an issue with the Ruby CLI. It may no-longer be needed with the new Go CLI. @capitancambio does it ring a bell ?

I can add export JAVA_OPTS="-XX:OnOutOfMemoryError=\"kill -9 %p\" -Xms256m -Xmx512m" to /etc/default/pipeline2d and it still works.

Regarding the issue with the ruby cli, honestly I don't remember, but I presume that it was same issue affecting the script, it still should affect the go cli. It should be a matter of testing if it works, the launching part of the go cli is here: https://github.com/daisy/pipeline-cli-go/blob/master/cli/starter.go

On the other hand I'm polishing a service installer/runner for windows using yajws, it should be fairly easy to setup a linux counterpart.

Should we close this? because we already changed to eval exec in commit 1bf37c1

Yes, I think it's fixed, good catch.