kuangchanglang / graceful

graceful reload golang http server, zero downtime, compatible with systemd, supervisor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WithStopSignals has bug?

neoli0222 opened this issue · comments

commented

It seems WithStopSignals just adds a new stop signal, other existed stop signals are not canceled.

graceful.WithStopSignals([]syscall.Signal{syscall.SIGKILL})
after setting stop signal to SIGKILL, SIGTERM and SIGINT can still stop the server.

I add this to avoid this problem
signal.Ignore(syscall.SIGTERM, syscall.SIGINT)

Hi @lpy-neo , WithStopSignals registers signals for handling server graceful shutdown, other unregistered signals are not shielded, which will still work as default behavior, such as SIGTERM will kill the process.
Ignore signals manually on your scenario should be the proper way, WithStopSignals is not well named and documented.

commented

@kuangchanglang Thanks for your reply.
By the way, as SIGKILL can't be caught, so it may be more helpful (to the newbies) to point out this fact. Because it seems WithStopSignals(SIGKILL) can do graceful stopping work.