It sounds as if you might be running your "REST endpoint" program from an interactive shell (i.e., a terminal) and sending SIGTERM by pressing something like Ctrl-C. Interactive job control, which includes how signals generated by a "terminal" are handled, is a complex topic. So we need to know how you are sending SIGTERM to your process. Is it by something like the `kill` command or syscall to a specific PID or by pressing keys on your terminal to terminate the process?
On Tue, Mar 23, 2021 at 8:47 PM Madscientist Microneil < [email protected]> wrote: > Hi, > > I've got a REST endpoint coded in go and it communicates with various > child processes to get it's work done. > > I've used > > // Set up to handle signals so we can stop when asked > done := make(chan os.Signal, 3) > signal.Notify(done, os.Interrupt, syscall.SIGINT, syscall.SIGTERM) > > and > > <-done > > to capture sigTERM and a few others so that when the server is being shut > down for maintenance it will cleanly finish the requests it is working on > before it shuts down. > > Unfortunately, it seems that the child processes get sigTERM right away > and as a result they die so the requests that are in flight end up broken. > > Did I miss a step? > > Thanks, > _M > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/b99a53f4-732a-489c-be6e-572354cf7386n%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/b99a53f4-732a-489c-be6e-572354cf7386n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Kurtis Rader Caretaker of the exceptional canines Junior and Hank -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CABx2%3DD-wMpjkWzeWFHQFRgY_dJ8cH2LYW9y_04%2B96zUxon-cgA%40mail.gmail.com.
