I set listeners in my application to catch SIGTERM, SIGINT and SIGUSR2:
process.on 'SIGTERM', ->
killExecutors 'SIGTERM'
process.on 'SIGINT', ->
killExecutors 'SIGINT'
process.on 'SIGUSR2', ->
killExecutors 'SIGUSR2'
It works as expected. When I run it inside the docker instance:
FROM node:4.4.7
MAINTAINER Newborns <newborns@versul.com.br>
COPY . /src
EXPOSE 7733
WORKDIR /src
RUN npm install
CMD ["./node_modules/.bin/coffee", "feeder.coffee"]
Everything works perfectly. BUT when I add the node flag to the execution
FROM node:4.4.7
MAINTAINER Newborns <newborns@versul.com.br>
COPY . /src
EXPOSE 7733
WORKDIR /src
RUN npm install
CMD ["./node_modules/.bin/coffee", "--nodejs", "--max_old_space_size=384", "feeder.coffee"]
he stops capturing signals. I tried changing the exec CMD form to
CMD ./node_modules/.bin/coffee --nodejs --max_old_space_size=384 feeder.coffee
but still not working. What changes are made with and without flags?
EDIT:
Actually, what happens is that docker starts one process when flags are not transmitted
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 4.2 1.0 960940 85424 ? Ssl 20:21 0:01 node ./node_modules/.bin/coffee feeder.coffee
root 16 0.1 0.0 20220 2884 ? Ss 20:22 0:00 bash
root 20 0.0 0.0 17500 2064 ? R+ 20:22 0:00 ps -aux
and two processes when flags are passed
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.1 0.3 707704 25272 ? Ssl 20:17 0:00 node ./node_modules/.bin/coffee
root 10 1.7 1.1 965900 90068 ? Sl 20:17 0:01 /usr/local/bin/node
Question: why?