Skip to content

Commit

Permalink
Merge pull request #1136 from jcmoraisjr/jm-pid-group
Browse files Browse the repository at this point in the history
Move embedded haproxy process to a distinct pid group
  • Loading branch information
jcmoraisjr authored Jun 13, 2024
2 parents dfeb920 + d8bc567 commit d0deb9d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,7 @@ RUN mkdir -p /var/empty /etc/haproxy /var/lib/haproxy /var/run/haproxy\

STOPSIGNAL SIGTERM
USER haproxy

# dumb-init reaps the old haproxy process in the embedded, non master-worker mode,
# after receiving SIGUSR1, avoiding it to become a zombie.
ENTRYPOINT ["/usr/bin/dumb-init", "--", "/start.sh"]
1 change: 1 addition & 0 deletions pkg/haproxy/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,7 @@ func (i *instance) startHAProxySync() {
"-f", i.options.HAProxyCfgDir)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
if err := cmd.Start(); err != nil {
i.logger.Error("error starting haproxy: %v", err)
return
Expand Down
3 changes: 3 additions & 0 deletions rootfs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,7 @@ RUN mkdir -p /var/empty /etc/haproxy /var/lib/haproxy /var/run/haproxy\

STOPSIGNAL SIGTERM
USER haproxy

# dumb-init reaps the old haproxy process in the embedded, non master-worker mode,
# after receiving SIGUSR1, avoiding it to become a zombie.
ENTRYPOINT ["/usr/bin/dumb-init", "--", "/start.sh"]

0 comments on commit d0deb9d

Please sign in to comment.