michaeljmarshall opened a new issue #8770:
URL: https://github.com/apache/pulsar/issues/8770


   I am deploying a pulsar cluster on Kubernetes using the 
`apachepulsar/pulsar-all:2.6.2` docker image. I start each of the component 
containers using the `bin/pulsar` script. This is the same method used by the 
pulsar helm chart.
   
   I've noticed that when stopping any of the component pods (Zookeeper, 
Broker, Bookkeeper), they do not run their shutdown hooks, but are instead 
killed forcefully after the configured grace period. In looking at the 
`bin/pulsar` script, I can see that the script ends by running `exec` on the 
java process without trapping the SIGTERM sent to the container and forwarding 
it to the process's pid. For example, here is the script that starts a bookie 
pod:
   
   
https://github.com/apache/pulsar/blob/411bf71006039af661be13c54dda4ce074f97679/bin/pulsar#L312
   
   Because we don't forward it, the java process never receives the SIGTERM 
notification. I'd like to propose modifying the `bin/pulsar` script to properly 
trap the SIGTERM and pass it to the process.
   
   I'm happy to submit a PR if there is support for this idea.
   
   Additionally, I noticed that there is a `bin/pulsar-daemon` script that 
starts a component process and writes the pid to a file in an attempt to 
properly manage the communicate the SIGTERM. However, the way that script is 
written, it exits after dispatching the component process, which leads the 
container to exit. It seems like this script would have a different use case 
than running in a container. Further, I don't see a use case where someone 
would want to run any of the components using `bin/pulsar` without being able 
to cleanly shut them down.


----------------------------------------------------------------
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:
[email protected]


Reply via email to