When daemonizing, the pages subprocess is fragile about files being opened early in initialization
Observed when coming up with !76 (merged) and !75 (merged)
In the daemonization flow, the root gitlab-pages process forks a child, sets its uid and gid, and passes it several file descriptors:
- one per listener
- one to pass serialized configuration data down
If the subprocess opens any files between process start and "claiming" those file descriptors in app.go
with listenAndServe
, we seem to trample all over this delicate setup and break the subprocess start.
This is surprising, restricts our ability to restructure the system, and should be fixed. If we have to do something to prevent these file descriptors from being trampled on, let's do it as the first lines in main.go
.