Search code examples
gorestart

Graceful restart to keep connections open


I am sure I saw some open source server written in Go that was able to restart and keep connections open.

I can't find it to learn that technique.

I know apache.httpd has apachectl graceful that restarts and keeps connections open.

How does it done in general and in Go?

I thought it must fork and 1 exit, 2 exec(new go app) and link connections by Fd.

But in Go I can find only ForkExec function. I think Fork is required. Also syscall package is not very well documented.


Solution

  • CloseOnExec may help,

    FileListener, CloseOnExec and gracefully restarting servers

    Zero Downtime upgrades of TCP servers in Go