lhotari commented on pull request #59:
URL: https://github.com/apache/pulsar-helm-chart/pull/59#issuecomment-682162804


   > @lhotari 
[bin/pulsar](https://github.com/apache/pulsar/blob/master/bin/pulsar#L314) 
script already uses `exec` to running the process. Are you sure that we need 
this change?
   
   Yes, it's needed. `exec` is a shell built-in and it will only be able to 
replace it's current shell not any parent shells. Therefore the exec in 
`bin/pulsar` won't affect the top-level shell (`command: ["sh", "-c"]`).
   
   You can quickly check the behavior without exec in docker:
   ```
   docker run --name pulsar-standalone --rm -it --entrypoint '/bin/sh' 
apachepulsar/pulsar:2.6.1 -c 'bin/apply-config-from-env.py conf/standalone.conf 
&& bin/pulsar standalone'
   ```
   
   ```
   $ docker exec -it pulsar-standalone ps -ef
   UID        PID  PPID  C STIME TTY          TIME CMD
   root         1     0  0 19:56 pts/0    00:00:00 /bin/sh -c 
bin/apply-config-from
   root         7     1 99 19:56 pts/0    00:01:01 
/usr/local/openjdk-8/bin/java -c
   root       685     0 10 19:56 pts/1    00:00:00 ps -ef
   ```
   
   As it can be seen, /bin/sh is PID 1 in the docker container when exec isn't 
used.
   
   
   after adding `exec` this changes:
   ```
   docker run --name pulsar-standalone --rm -it --entrypoint '/bin/sh' 
apachepulsar/pulsar:2.6.1 -c 'bin/apply-config-from-env.py conf/standalone.conf 
&& exec bin/pulsar standalone'
   ```
   
   ```
   $ docker exec -it pulsar-standalone ps -ef
   UID        PID  PPID  C STIME TTY          TIME CMD
   root         1     0 99 19:58 pts/0    00:00:14 
/usr/local/openjdk-8/bin/java -c
   root       253     0  0 19:58 pts/1    00:00:00 ps -ef
   ```
   
   the `java` process is now PID 1 and it will receive OS signals as 
recommended in Docker and k8s documentation (links provided in the issue 
description).
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to