eiffel-community / eiffel-remrem-publish

eiffel-remrem-publish
https://eiffel-community.github.io/eiffel-remrem-publish
Apache License 2.0
8 stars 77 forks source link

Docker container doesn't respond correctly to SIGTERM #177

Open magnusbaeck opened 5 years ago

magnusbaeck commented 5 years ago

Description

When a Docker container is stopped via docker stop or docker restart, SIGTERM is sent to pid 1. The container is given a limited time (default 10 s) to shut down before a SIGKILL is issued. REMReM Publish fails to respond to the SIGTERM signal since pid 1 is the bash process running start-service.sh so you have to wait around for the SIGKILL. We should make sure the Tomcat JVM becomes pid 1 to speed up shut downs and allow the process to clean up. It's probably enough to change

/eiffel/health-check.sh && catalina.sh run

in start-service.sh to:

/eiffel/health-check.sh && exec catalina.sh run

Benefits

Quicker container shutdowns (and therefore restarts) reduce downtime and is less of a PITA when testing the container. Also, if we want to hook into the SIGTERM and perform some kind of cleanup we have to make this change since the eventual SIGKILL signal can't be trapped.

Possible Drawbacks

None.

magnusbaeck commented 5 years ago

Unfortunately the patch described above isn't enough. There's a lot of stuff going on in catalina.sh and the JVM ends up as pid 10 or so. If we drop the external Tomcat as suggested in https://github.com/eiffel-community/eiffel-remrem-generate/issues/142 I suspect this issue will solve itself.

SantoshNC68 commented 4 years ago

Hi @magnusbaeck, can you provide a fix for this.

magnusbaeck commented 4 years ago

Yes, but I won't have time for it until next week.