Hm… I can reproduce this only with fly m restart
—not with fly m stop
.
(Maybe it’s this only-on-restarts aspect that is the new piece of information, relative to your post in July? I think it’s best if these are structured as a continuous flow of conversation, with everyone’s contributions magnifying the others’, rather than arriving scattershot.)
app = "thirty"
primary_region = "ewr"
kill_signal = "SIGTERM"
[[restart]]
policy = "no"
FROM debian:bookworm-slim
COPY --chmod=755 thirty /usr/local/bin/
CMD ["thirty"]
#!/bin/bash -eup
echo thirty
function l() { echo 30: "$1" 1>&2; sleep 0.1; }
trap 'l sigint' SIGINT
trap 'l sigterm; exit 0' SIGTERM
trap -p
while true; do sleep 0.1; done
And then, with fly m restart
, the logs read…
22:59:59Z app[28*] ewr [info] INFO Sending signal SIGINT to main child process w/ PID 321
22:59:59Z app[28*] ewr [info]30: sigint
23:00:04Z app[28*] ewr [info] INFO Sending signal SIGTERM to main child process w/ PID 321
23:00:04Z app[28*] ewr [info]30: sigterm
23:00:05Z app[28*] ewr [info] INFO Main child exited normally with code: 0
Whereas fly m stop
goes straight to SIGTERM
…
23:01:36Z app[28*] ewr [info] INFO Sending signal SIGTERM to main child process w/ PID 323
23:01:36Z app[28*] ewr [info]30: sigterm
23:01:37Z app[28*] ewr [info] INFO Main child exited normally with code: 0
But these cases should really be the same. It’s hard to think of a reason why stop and restart would have different shutdown mechanisms…
Aside: The odd-looking sleep 0.1
in the l
function avoids a distracting stderr to vsock zero copy err: Broken pipe
, which I don’t think is related. (Others have reported it, as well.)