cf stop not sending SIGTERM


Will Tran
 

I'm not seeing graceful shutdown behaviour when I cf stop a Java app. By the looks of Garden SIGTERM is sent and if the process is still alive after 10 seconds SIGKILL is sent: https://github.com/cloudfoundry-incubator/garden-linux/blob/8ab2cbf0696fd0b6bd1a0f15f2d3a463e4acbdac/linux_backend/skeleton/stop.sh#L54-L72

I don't see this in my dead simple app Spring Boot app however: https://github.com/william-tran/cf-shutdown-hook. When I SIGTERM locally it only takes a second to gracefully shutdown.

I'm seeing this on PCF 1.6.8-build.1 (cf 225.3, garden 0.330.0)


Eric Malm <emalm@...>
 

Hi, William,

What version of the Java buildpack are you using? The introduction of the
memory calculator in v3.1 resulted in a more complicated start-command that
meant the app's java process wouldn't receive a TERM signal when the Diego
cell rep stopped the instance, but this was fixed in v3.4 of the buildpack
with a judiciously placed `exec`. Diego doesn't call the Stop() method on a
garden container, instead opting either to call Signal() on individual
processes that it has invoked or to call Destroy() the container.

Thanks,
Eric, CF Runtime Diego PM

On Thu, Apr 7, 2016 at 12:53 PM, William Tran <wtran(a)pivotal.io> wrote:

I'm not seeing graceful shutdown behaviour when I cf stop a Java app. By
the looks of Garden SIGTERM is sent and if the process is still alive after
10 seconds SIGKILL is sent:
https://github.com/cloudfoundry-incubator/garden-linux/blob/8ab2cbf0696fd0b6bd1a0f15f2d3a463e4acbdac/linux_backend/skeleton/stop.sh#L54-L72

I don't see this in my dead simple app Spring Boot app however:
https://github.com/william-tran/cf-shutdown-hook. When I SIGTERM locally
it only takes a second to gracefully shutdown.

I'm seeing this on PCF 1.6.8-build.1 (cf 225.3, garden 0.330.0)


Will Tran
 

Thanks! This was happening in JBP v3.3.1, I just tested with JBPv 3.6 and it's working.